From 4320e60a5a42ef5db5d3e3fbd462b2013bf0e0f1 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Fri, 30 Aug 2024 07:12:39 -0300 Subject: [PATCH] better implementation --- src/utils/patches.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/utils/patches.ts b/src/utils/patches.ts index 979e49fd7..c5bd81205 100644 --- a/src/utils/patches.ts +++ b/src/utils/patches.ts @@ -24,8 +24,7 @@ export function canonicalizeMatch(match: T): T { } const canonRegex = new RegExp(match.source.replaceAll(String.raw`\i`, String.raw`(?:[A-Za-z_$][\w$]*)`), match.flags); - const originalToString = canonRegex.toString.bind(canonRegex); - canonRegex.toString = () => originalToString().replaceAll(String.raw`(?:[A-Za-z_$][\w$]*)`, String.raw`\i`); + canonRegex.toString = match.toString.bind(match); return canonRegex as T; }