Skip to content

Commit 1ce6eef

Browse files
committed
Revert "Merge pull request #4 from yahoo/json-stringify-space"
This reverts commit 9264c90, reversing changes made to bc8e811.
1 parent 9589229 commit 1ce6eef

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

index.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ var UNICODE_CHARS = {
2525
'\u2029': '\\u2029'
2626
};
2727

28-
// There's an issue with Node 0.10 (V8 3.14.5.9) which causes `JSON.stringify()`
29-
// and the subsequent `str.replace()` call to take over 100x more time than when
30-
// a the `JSON.stringify()` replacer function is used and the data being
31-
// serialized is very large (500KB). A remedy to this is setting the
32-
// `JSON.stringify()` `space` option to a truthy value.
33-
var SPACE = 2;
34-
3528
module.exports = function serialize(obj) {
3629
var functions = [];
3730
var regexps = [];
@@ -50,7 +43,7 @@ module.exports = function serialize(obj) {
5043
}
5144

5245
return value;
53-
}, SPACE);
46+
});
5447

5548
// Protects against `JSON.stringify()` returning `undefined`, by serializing
5649
// to the literal string: "undefined".

test/unit/serialize.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('serialize( obj )', function () {
4646
});
4747

4848
it('should serialize JSON to a JSON string', function () {
49-
expect(serialize(data)).to.equal(JSON.stringify(data, null, 2));
49+
expect(serialize(data)).to.equal(JSON.stringify(data));
5050
});
5151

5252
it('should deserialize a JSON string to a JSON object', function () {

0 commit comments

Comments
 (0)