MCPcopy
hub / github.com/vercel/next.js / escapeStringRegexp

Function escapeStringRegexp

packages/font/src/google/loader.ts:20–26  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

18const reReplaceRegExp = /[|\\{}()[\]^$+*?.-]/g
19
20function escapeStringRegexp(str: string) {
21 // see also: https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/escapeRegExp.js#L23
22 if (reHasRegExp.test(str)) {
23 return str.replace(reReplaceRegExp, '\\$&')
24 }
25 return str
26}
27
28const nextFontGoogleFontLoader: FontLoader = async ({
29 functionName,

Callers 6

nextFontGoogleFontLoaderFunction · 0.70
index.test.tsFile · 0.50
index.test.tsFile · 0.50
testsFunction · 0.50

Calls 2

testMethod · 0.65
replaceMethod · 0.65

Tested by 1

testsFunction · 0.40

Used in the wild real call sites across dependent graphs

searching dependent graphs…