fix: replace regex with replaceAll for secure string replace

This commit is contained in:
reaper
2025-11-12 15:12:51 +05:30
parent 67c9f1373e
commit be34c86c47
2 changed files with 2 additions and 1 deletions

View File

@@ -41,7 +41,7 @@ export function patternHasher(input: string, pattern: string | RegExp = VARIABLE
let clone = current;
for (const hash in hashToOriginal) {
const value = hashToOriginal[hash];
clone = clone.replace(new RegExp(`(${hash})`, 'g'), value);
clone = clone.replaceAll(hash, value);
}
return clone;
}

View File

@@ -3,6 +3,7 @@
"target": "ES6",
"esModuleInterop": true,
"strict": true,
"lib": ["es2021"],
"skipLibCheck": true,
"jsx": "react",
"module": "ESNext",