1
0
Fork 1
mirror of https://github.com/Vendicated/Vencord.git synced 2025-01-25 00:36:23 +00:00

better implementation

This commit is contained in:
Nuckyz 2024-08-30 07:12:39 -03:00
parent 0a09ee1dc6
commit 4320e60a5a
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9

View file

@ -24,8 +24,7 @@ export function canonicalizeMatch<T extends RegExp | string>(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;
}