We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 357d5b2 commit 6ad20afCopy full SHA for 6ad20af
src/utils.ts
@@ -92,6 +92,8 @@ export function getCaptured(input: string, re: RegExp): string[] {
92
* A simplified version of `String.replaceAll` to address compatibility issues on Node 14
93
*/
94
export function replaceAll(source: string, searchValue: string, replaceValue: string): string {
95
+ if (typeof source.replaceAll === 'function')
96
+ return source.replaceAll(searchValue, replaceValue)
97
const escaped = escapeStringRegexp(searchValue)
98
const replaceRegExp = new RegExp(escaped, 'g')
99
return source.replace(replaceRegExp, replaceValue)
0 commit comments