File tree Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
2
json2.js
3
- 2013-05-26
3
+ 2014-02-04
4
4
5
5
Public Domain.
6
6
@@ -192,19 +192,11 @@ if (typeof JSON !== 'object') {
192
192
} ;
193
193
}
194
194
195
- var cx = / [ \u0000 \u00ad \u0600 - \u0604 \u070f \u17b4 \u17b5 \u200c - \u200f \u2028 - \u202f \u2060 - \u206f \ufeff \ufff0 - \uffff ] / g ,
196
- escapable = / [ \\ \" \x00 - \x1f \x7f - \x9f \u00ad \u0600 - \u0604 \u070f \u17b4 \u17b5 \u200c - \u200f \u2028 - \u202f \u2060 - \u206f \ufeff \ufff0 - \uffff ] / g ,
195
+ var cx ,
196
+ escapable ,
197
197
gap ,
198
198
indent ,
199
- meta = { // table of character substitutions
200
- '\b' : '\\b' ,
201
- '\t' : '\\t' ,
202
- '\n' : '\\n' ,
203
- '\f' : '\\f' ,
204
- '\r' : '\\r' ,
205
- '"' : '\\"' ,
206
- '\\' : '\\\\'
207
- } ,
199
+ meta ,
208
200
rep ;
209
201
210
202
@@ -356,6 +348,16 @@ if (typeof JSON !== 'object') {
356
348
// If the JSON object does not yet have a stringify method, give it one.
357
349
358
350
if ( typeof JSON . stringify !== 'function' ) {
351
+ escapable = / [ \\ \" \x00 - \x1f \x7f - \x9f \u00ad \u0600 - \u0604 \u070f \u17b4 \u17b5 \u200c - \u200f \u2028 - \u202f \u2060 - \u206f \ufeff \ufff0 - \uffff ] / g;
352
+ meta = { // table of character substitutions
353
+ '\b' : '\\b' ,
354
+ '\t' : '\\t' ,
355
+ '\n' : '\\n' ,
356
+ '\f' : '\\f' ,
357
+ '\r' : '\\r' ,
358
+ '"' : '\\"' ,
359
+ '\\' : '\\\\'
360
+ } ;
359
361
JSON . stringify = function ( value , replacer , space ) {
360
362
361
363
// The stringify method takes a value and an optional replacer, and an optional
@@ -403,6 +405,7 @@ if (typeof JSON !== 'object') {
403
405
// If the JSON object does not yet have a parse method, give it one.
404
406
405
407
if ( typeof JSON . parse !== 'function' ) {
408
+ cx = / [ \u0000 \u00ad \u0600 - \u0604 \u070f \u17b4 \u17b5 \u200c - \u200f \u2028 - \u202f \u2060 - \u206f \ufeff \ufff0 - \uffff ] / g;
406
409
JSON . parse = function ( text , reviver ) {
407
410
408
411
// The parse method takes a text and an optional reviver function, and returns
You can’t perform that action at this time.
0 commit comments