You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
console.assert(Flatted.stringify(a)==='[["0",1,"1",true],"two"]','values in Array');
24
-
console.assert(Flatted.stringify(o)==='[{"o":"0","one":1,"two":"1","three":true},"two"]','values in Object');
23
+
console.assert(TJS.stringify(a)==='[["0",1,"1",true],"two"]','values in Array');
24
+
console.assert(TJS.stringify(o)==='[{"o":"0","one":1,"two":"1","three":true},"two"]','values in Object');
25
25
26
26
27
27
a.push(o);
28
28
o.a=a;
29
29
30
-
console.assert(Flatted.stringify(a)==='[["0",1,"1",true,"2"],"two",{"o":"2","one":1,"two":"1","three":true,"a":"0"}]','object in Array');
31
-
console.assert(Flatted.stringify(o)==='[{"o":"0","one":1,"two":"1","three":true,"a":"2"},"two",["2",1,"1",true,"0"]]','array in Object');
30
+
console.assert(TJS.stringify(a)==='[["0",1,"1",true,"2"],"two",{"o":"2","one":1,"two":"1","three":true,"a":"0"}]','object in Array');
31
+
console.assert(TJS.stringify(o)==='[{"o":"0","one":1,"two":"1","three":true,"a":"2"},"two",["2",1,"1",true,"0"]]','array in Object');
32
32
33
33
a.push({test: 'OK'},[1,2,3]);
34
34
o.test={test: 'OK'};
35
35
o.array=[1,2,3];
36
36
37
-
console.assert(Flatted.stringify(a)==='[["0",1,"1",true,"2","3","4"],"two",{"o":"2","one":1,"two":"1","three":true,"a":"0","test":"5","array":"6"},{"test":"7"},[1,2,3],{"test":"7"},[1,2,3],"OK"]','objects in Array');
38
-
console.assert(Flatted.stringify(o)==='[{"o":"0","one":1,"two":"1","three":true,"a":"2","test":"3","array":"4"},"two",["2",1,"1",true,"0","5","6"],{"test":"7"},[1,2,3],{"test":"7"},[1,2,3],"OK"]','objects in Object');
37
+
console.assert(TJS.stringify(a)==='[["0",1,"1",true,"2","3","4"],"two",{"o":"2","one":1,"two":"1","three":true,"a":"0","test":"5","array":"6"},{"test":"7"},[1,2,3],{"test":"7"},[1,2,3],"OK"]','objects in Array');
38
+
console.assert(TJS.stringify(o)==='[{"o":"0","one":1,"two":"1","three":true,"a":"2","test":"3","array":"4"},"two",["2",1,"1",true,"0","5","6"],{"test":"7"},[1,2,3],{"test":"7"},[1,2,3],"OK"]','objects in Object');
39
39
40
-
a=Flatted.parse(Flatted.stringify(a));
41
-
o=Flatted.parse(Flatted.stringify(o));
40
+
a=TJS.parse(TJS.stringify(a));
41
+
o=TJS.parse(TJS.stringify(o));
42
42
43
43
console.assert(a[0]===a,'parsed Array');
44
44
console.assert(o.o===o,'parsed Object');
@@ -67,25 +67,25 @@ console.assert(
67
67
68
68
console.assert(o.a===o.a[0]&&o===o.a[4],'object recursive values are OK');
69
69
70
-
console.assert(Flatted.parse(Flatted.stringify(1))===1,'numbers can be parsed too');
71
-
console.assert(Flatted.parse(Flatted.stringify(false))===false,'booleans can be parsed too');
72
-
console.assert(Flatted.parse(Flatted.stringify(null))===null,'null can be parsed too');
73
-
console.assert(Flatted.parse(Flatted.stringify('test'))==='test','strings can be parsed too');
70
+
console.assert(TJS.parse(TJS.stringify(1))===1,'numbers can be parsed too');
71
+
console.assert(TJS.parse(TJS.stringify(false))===false,'booleans can be parsed too');
72
+
console.assert(TJS.parse(TJS.stringify(null))===null,'null can be parsed too');
73
+
console.assert(TJS.parse(TJS.stringify('test'))==='test','strings can be parsed too');
74
74
75
75
vard=newDate;
76
-
console.assert(Flatted.parse(Flatted.stringify(d))===d.toISOString(),'dates can be parsed too');
76
+
console.assert(TJS.parse(TJS.stringify(d))===d.toISOString(),'dates can be parsed too');
console.assert(str==='[{"outer":"1"},["2"],{"a":"3","c":"4","one":"5","many":"6","e":"7"},"b","d",{"name":"8","value":"5"},["5"],"f","TEST"]','string is correct');
console.assert(str==='[{"prop":"1","a":"2","b":"3"},{"value":123},["4","5"],{"e":"6","t":"7","p":4},{},{"b":"8"},"f",{"a":"9"},["10"],"sup",{"a":1,"d":2,"c":"7","z":"11","h":1},{"g":2,"a":"7","b":"12","f":6},{"r":4,"u":"7","c":5}]','string is OK');
295
-
output=Flatted.parse(str);
295
+
output=TJS.parse(str);
296
296
console.assert(output.b.t.a==='sup'&&output.a[1].b[0].c===output.b.t,'so is the object');
297
297
}());
298
298
299
299
(function(){
300
300
varo={bar: 'something ~ baz'};
301
-
vars=Flatted.stringify(o);
301
+
vars=TJS.stringify(o);
302
302
console.assert(s==='[{"bar":"1"},"something ~ baz"]','string is correct');
303
-
varoo=Flatted.parse(s);
303
+
varoo=TJS.parse(s);
304
304
console.assert(oo.bar===o.bar,'parse is correct');
305
305
}());
306
306
@@ -325,9 +325,9 @@ console.assert(Flatted.parse(
325
325
o.c.cc.cca=o.c;
326
326
o.c.cd.cda=o.c.ca.caa;
327
327
328
-
vars=Flatted.stringify(o);
328
+
vars=TJS.stringify(o);
329
329
console.assert(s==='[{"a":"1","b":"0","c":"2"},{"aa":"3"},{"ca":"4","cb":"5","cc":"6","cd":"7","ce":"8","cf":"9"},{"aaa":"10"},{"caa":"4"},{"cba":"5"},{"cca":"2"},{"cda":"4"},"value2","value3","value1"]','string is correct');
0 commit comments