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

Function escapeStringForJs

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

Source from the content-addressed store, hash-verified

43 * "special characters (\ ` $) will be escaped" -> "special characters (\\ \` \$) will be escaped"
44 */
45export function escapeStringForJs(str: string) {
46 return str
47 .replace(/\\/g, "\\\\")
48 .replace(/`/g, "\\`")
49 .replace(/\$/g, "\\$");
50}
51
52let _mode: SnapshotMode;
53/**

Callers 2

updateSnapshotsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected