mirror of
https://github.com/amark/gun.git
synced 2025-06-05 21:56:51 +00:00
mark fails at JSON again
This commit is contained in:
parent
233d2612d1
commit
ef59ea185c
@ -181,7 +181,7 @@ yson.stringifyAsync = function(data, done, replacer, space, ctx){
|
|||||||
add += JSON.stringify(data); //ctx.text += '"'+data+'"';//JSON.stringify(data); // only if backslash
|
add += JSON.stringify(data); //ctx.text += '"'+data+'"';//JSON.stringify(data); // only if backslash
|
||||||
break;
|
break;
|
||||||
case 'number':
|
case 'number':
|
||||||
add += data;
|
add += (isNaN(data)? 'null' : data);
|
||||||
break;
|
break;
|
||||||
case 'object':
|
case 'object':
|
||||||
if(!data){
|
if(!data){
|
||||||
|
@ -106,10 +106,10 @@ describe('Gun', function(){
|
|||||||
function Foo(){}; Foo.prototype.toJSON = function(){};
|
function Foo(){}; Foo.prototype.toJSON = function(){};
|
||||||
//var obj = {"what\"lol": {"a": 1, "b": true, "c": false, "d": null, "wow": [{"z": 9}, true, "hi", 3.3]}};
|
//var obj = {"what\"lol": {"a": 1, "b": true, "c": false, "d": null, "wow": [{"z": 9}, true, "hi", 3.3]}};
|
||||||
var obj = {"what": {"a": 1, "b": true, "c": false, "d": null, "wow": [{"z": 9}, true, "hi", 3.3]}};
|
var obj = {"what": {"a": 1, "b": true, "c": false, "d": null, "wow": [{"z": 9}, true, "hi", 3.3]}};
|
||||||
var obj = [{x:"test 😎\\😄🔥",z:"test\\","what\"lol": {"0": 1.01},a:true,b: new Foo,c:3,y:"yes","get":{"#":"chat"},wow:undefined,foo:[1,function(){}, function(){}, 'go'],blah:{a:5,toJSON:function(){ return 9 }}}, {webRTCsdp: "v=0\r\no=-"}, [[]], 10e9];
|
var obj = [{x:"test 😎\\😄🔥",z:"test\\","what\"lol": {"0": 1.01},a:true,b: new Foo,c:3,y:"yes","get":{"#":"chat"},wow:undefined,foo:[1,function(){}, function(){}, 'go'],blah:{a:5,toJSON:function(){ return 9 }}}, {webRTCsdp: "v=0\r\no=-"}, [[]], 10e9, NaN];
|
||||||
JSON.stringifyAsync(obj, function(err, text){
|
JSON.stringifyAsync(obj, function(err, text){
|
||||||
JSON.parseAsync(text, function(err, data){
|
JSON.parseAsync(text, function(err, data){
|
||||||
expect(data).to.be.eql([{x:"test 😎\\😄🔥",z:"test\\","what\"lol": {"0": 1.01},a:true,c:3,y:"yes","get":{"#":"chat"},foo:[1,null,null,'go'],blah:9}, {webRTCsdp: "v=0\r\no=-"}, [[]], 10e9]);
|
expect(data).to.be.eql([{x:"test 😎\\😄🔥",z:"test\\","what\"lol": {"0": 1.01},a:true,c:3,y:"yes","get":{"#":"chat"},foo:[1,null,null,'go'],blah:9}, {webRTCsdp: "v=0\r\no=-"}, [[]], 10e9, null]);
|
||||||
var obj = {a: [], b: [""], c: ["", 1], d: [1, ""], e: {"":[]}, "a\"b": {0: 1}, wow: {'': {cool: 1}}};obj.lol = {0: {sweet: 9}};obj.wat = {"": 'cool'};obj.oh = {phew: {}, "": {}};
|
var obj = {a: [], b: [""], c: ["", 1], d: [1, ""], e: {"":[]}, "a\"b": {0: 1}, wow: {'': {cool: 1}}};obj.lol = {0: {sweet: 9}};obj.wat = {"": 'cool'};obj.oh = {phew: {}, "": {}};
|
||||||
JSON.stringifyAsync(obj, function(err, text2){
|
JSON.stringifyAsync(obj, function(err, text2){
|
||||||
JSON.parseAsync(text2, function(err, data){
|
JSON.parseAsync(text2, function(err, data){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user