(value)
| 2313 | // `Quote(value)` operation defined in ES 5.1 section 15.12.3. |
| 2314 | var unicodePrefix = "\\u00"; |
| 2315 | var quote = function (value) { |
| 2316 | var result = '"', index = 0, length = value.length, useCharIndex = !charIndexBuggy || length > 10; |
| 2317 | var symbols = useCharIndex && (charIndexBuggy ? value.split("") : value); |
| 2318 | for (; index < length; index++) { |
| 2319 | var charCode = value.charCodeAt(index); |
| 2320 | // If the character is a control character, append its Unicode or |
| 2321 | // shorthand escape sequence; otherwise, append the character as-is. |
| 2322 | switch (charCode) { |
| 2323 | case 8: case 9: case 10: case 12: case 13: case 34: case 92: |
| 2324 | result += Escapes[charCode]; |
| 2325 | break; |
| 2326 | default: |
| 2327 | if (charCode < 32) { |
| 2328 | result += unicodePrefix + toPaddedString(2, charCode.toString(16)); |
| 2329 | break; |
| 2330 | } |
| 2331 | result += useCharIndex ? symbols[index] : value.charAt(index); |
| 2332 | } |
| 2333 | } |
| 2334 | return result + '"'; |
| 2335 | }; |
| 2336 | |
| 2337 | // Internal: Recursively serializes an object. Implements the |
| 2338 | // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. |
no test coverage detected