MCPcopy Index your code
hub / github.com/CreateJS/PreloadJS / quote

Function quote

lib/preloadjs-NEXT.js:1360–1380  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

1358 // `Quote(value)` operation defined in ES 5.1 section 15.12.3.
1359 var unicodePrefix = "\\u00";
1360 var quote = function (value) {
1361 var result = '"', index = 0, length = value.length, useCharIndex = !charIndexBuggy || length > 10;
1362 var symbols = useCharIndex && (charIndexBuggy ? value.split("") : value);
1363 for (; index < length; index++) {
1364 var charCode = value.charCodeAt(index);
1365 // If the character is a control character, append its Unicode or
1366 // shorthand escape sequence; otherwise, append the character as-is.
1367 switch (charCode) {
1368 case 8: case 9: case 10: case 12: case 13: case 34: case 92:
1369 result += Escapes[charCode];
1370 break;
1371 default:
1372 if (charCode < 32) {
1373 result += unicodePrefix + toPaddedString(2, charCode.toString(16));
1374 break;
1375 }
1376 result += useCharIndex ? symbols[index] : value.charAt(index);
1377 }
1378 }
1379 return result + '"';
1380 };
1381
1382 // Internal: Recursively serializes an object. Implements the
1383 // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations.

Callers 1

serializeFunction · 0.70

Calls 1

toPaddedStringFunction · 0.70

Tested by

no test coverage detected