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

Function htmlEscapeJsonString

packages/next/src/shared/lib/htmlescape.ts:24–26  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

22const ATTRIBUTE_ESCAPE_REGEX = /[&"'<>]/g
23
24export function htmlEscapeJsonString(str: string): string {
25 return str.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match])
26}
27
28export function htmlEscapeAttributeString(str: string): string {
29 return str.replace(

Callers 5

ScriptFunction · 0.90
getInlineScriptSourceMethod · 0.90
writeInitialInstructionsFunction · 0.90
htmlescape.test.tsFile · 0.90

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected