| 202 | |
| 203 | |
| 204 | function quote(string) { |
| 205 | |
| 206 | // If the string contains no control characters, no quote characters, and no |
| 207 | // backslash characters, then we can safely slap some quotes around it. |
| 208 | // Otherwise we must also replace the offending characters with safe escape |
| 209 | // sequences. |
| 210 | |
| 211 | escapable.lastIndex = 0; |
| 212 | return escapable.test(string) ? |
| 213 | '"' + string.replace(escapable, function (a) { |
| 214 | var c = meta[a]; |
| 215 | return typeof c === 'string' ? c : |
| 216 | '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); |
| 217 | }) + '"' : |
| 218 | '"' + string + '"'; |
| 219 | } |
| 220 | |
| 221 | |
| 222 | function str(key, holder) { |