MCPcopy Create free account
hub / github.com/denoland/std / escapeStringForJs

Function escapeStringForJs

testing/_snapshot_utils.ts:50–55  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

48 * "special characters (\ ` $) will be escaped" -> "special characters (\\ \` \$) will be escaped"
49 */
50export function escapeStringForJs(str: string) {
51 return str
52 .replace(/\\/g, "\\\\")
53 .replace(/`/g, "\\`")
54 .replace(/\$/g, "\\$");
55}
56
57let _mode: SnapshotMode;
58/**

Callers 2

updateSnapshotsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected