MCPcopy Create free account
hub / github.com/RubyLouvre/anu / escapeString

Function escapeString

test/babel.js:50548–50559  ·  view source on GitHub ↗
(string)

Source from the content-addressed store, hash-verified

50546 '\\': '\\\\'
50547 };
50548 function escapeString(string) {
50549
50550 // If the string contains no control characters, no quote characters, and no
50551 // backslash characters, then we can safely slap some quotes around it.
50552 // Otherwise we must also replace the offending characters with safe escape
50553 // sequences.
50554 escapable.lastIndex = 0;
50555 return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
50556 var c = meta[a];
50557 return typeof c === 'string' ? c : "\\u" + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
50558 }) + '"' : '"' + string + '"';
50559 }
50560 // End
50561
50562 function internalStringify(holder, key, isTopLevel) {

Callers 1

internalStringifyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected