From a03f493893e409ac471c3b5e3c299df1d85397ef Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Fri, 26 Dec 2025 05:15:06 +0300 Subject: [PATCH] bugfix... Signed-off-by: Alex A. Naanou --- serialize2.js | 3 +++ test.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/serialize2.js b/serialize2.js index ce5655b..7309cb3 100644 --- a/serialize2.js +++ b/serialize2.js @@ -328,7 +328,10 @@ module.eJSON = { && initial.length++ continue } if(str.slice(i, i+EMPTY.length) == EMPTY){ + index++ i += EMPTY.length + if(str[i] == ','){ + i++ } // XXX this feels hackish -- can this be deligated to the handler??? initial instanceof Array && initial.length++ diff --git a/test.js b/test.js index e3f2f40..3ccc28a 100755 --- a/test.js +++ b/test.js @@ -37,7 +37,7 @@ var setups = test.Setups({ return '[]' }, // XXX BUG: trailing gets duplicated... 'array-sparse': function(assert){ - return '[1,,,2,]' }, + return '[,1,,,2,]' }, 'object-empty': function(assert){ return '{}' },