Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix serialization of sub-arrays

  • Loading branch information...
commit e9ccfa13c816325964dc8f700e44ffca991c3f6e 1 parent 5b9e0cb
@kriszyp authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 util/json-ext.js
View
6 util/json-ext.js
@@ -179,7 +179,7 @@ exports.stringify = ({}).toSource ?
length,
mind = gap,
partial,
- value = holder[key];
+ value = holder ? holder[key] : key;
// If we were called with a replacer function, then call the replacer to
@@ -231,11 +231,10 @@ exports.stringify = ({}).toSource ?
// The value is an array (or forEach-able). Stringify every element. Use null as a placeholder
// for non-JSON values.
-
length = value.length;
// TODO: properly handle async forEach
value.forEach(function(value, i){
- partial[i] = str(i, value) || 'null';
+ partial[i] = str(value) || 'null';
});
// Join all of the elements together, separated with commas, and wrap them in
@@ -248,6 +247,7 @@ exports.stringify = ({}).toSource ?
'[' + partial.join(',') + ']';
gap = mind;
return v;
+
}
if (value instanceof Date){
return "new Date(" + value.getTime() + ")";
Please sign in to comment.
Something went wrong with that request. Please try again.