MCPcopy
hub / github.com/Unitech/pm2 / escapeString

Function escapeString

lib/tools/json5.js:649–662  ·  view source on GitHub ↗
(string)

Source from the content-addressed store, hash-verified

647 '\\': '\\\\'
648 };
649 function escapeString(string) {
650
651// If the string contains no control characters, no quote characters, and no
652// backslash characters, then we can safely slap some quotes around it.
653// Otherwise we must also replace the offending characters with safe escape
654// sequences.
655 escapable.lastIndex = 0;
656 return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
657 var c = meta[a];
658 return typeof c === 'string' ?
659 c :
660 '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
661 }) + '"' : '"' + string + '"';
662 }
663 // End
664
665 function internalStringify(holder, key, isTopLevel) {

Callers 1

internalStringifyFunction · 0.85

Calls 2

sliceMethod · 0.80
toStringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…