json-stream-stringify
Advanced tools
Comparing version 1.3.3 to 1.3.4
@@ -18,3 +18,6 @@ 'use strict'; | ||
for (let obj of this._iter) { | ||
//console.log(obj, insertSeparator); | ||
if (obj.state === 'close') { | ||
insertSeparator = true; | ||
yield this.push(obj.type === Object ? '}' : ']'); | ||
@@ -21,0 +24,0 @@ continue; |
{ | ||
"name": "json-stream-stringify", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"description": "JSON.Stringify as a readable stream", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -40,3 +40,3 @@ 'use strict'; | ||
depth: 0, | ||
type: this._forcedCtxType || ctxType, | ||
type: ctxType, | ||
next: () => { | ||
@@ -43,0 +43,0 @@ let child = childIterator && childIterator.next(); |
21
test.js
@@ -83,4 +83,10 @@ 'use strict'; | ||
it('{a:[1], "b": 2} should be {"a":[1],"b":2}', createTest({ | ||
a: [1], b: 2 | ||
}, '{"a":[1],"b":2}')); | ||
it('[] should be []', createTest([], '[]')); | ||
it('[[[]],[[]]] should be [[[]],[[]]]', createTest([[[]],[[]]], '[[[]],[[]]]')); | ||
it('[1, undefined, 2] should be [1,null,2]', createTest([1, undefined, 2], '[1,null,2]')); | ||
@@ -108,3 +114,16 @@ | ||
it(`{ a: ReadableStream({name: 'name', date: date }) } should be [{},"a",null,"c"]`, createTest({ a: ReadableStream({name: 'name', date: date }) }, `{"a":[{"name":"name","date":"${date.toJSON()}"}]}`)); | ||
it(`{ a: ReadableStream({name: 'name', date: date }) } should be {"a":[{"name":"name","date":"${date.toJSON()}"}]}`, createTest({ | ||
a: ReadableStream({ | ||
name: 'name', | ||
date: date | ||
}) | ||
}, `{"a":[{"name":"name","date":"${date.toJSON()}"}]}`)); | ||
it(`{ a: ReadableStream({name: 'name', arr: [], date: date }) } should be {"a":[{"name":"name","arr":[],"date":"${date.toJSON()}"}]}`, createTest({ | ||
a: ReadableStream({ | ||
name: 'name', | ||
arr: [], | ||
date: date | ||
}) | ||
}, `{"a":[{"name":"name","arr":[],"date":"${date.toJSON()}"}]}`)); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20854
353