MCPcopy Create free account
hub / github.com/codemix/graph / literalEscape

Method literalEscape

packages/graph/src/grammar.js:61–71  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

59 }
60
61 function literalEscape(s) {
62 return unicodeEscape(s
63 .replace(/\\/g, "\\\\")
64 .replace(/"/g, "\\\"")
65 .replace(/\0/g, "\\0")
66 .replace(/\t/g, "\\t")
67 .replace(/\n/g, "\\n")
68 .replace(/\r/g, "\\r")
69 .replace(/[\x00-\x0F]/g, ch => "\\x0" + hex(ch))
70 .replace(/[\x10-\x1F\x7F-\x9F]/g, ch => "\\x" + hex(ch)));
71 }
72
73 function classEscape(s) {
74 return unicodeEscape(s

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected