mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-25 00:36:23 +00:00
better implementation
This commit is contained in:
parent
0a09ee1dc6
commit
4320e60a5a
1 changed files with 1 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue