Skip to content
Browse files

finally fixed the zero-length bug

  • Loading branch information...
1 parent aeb9be9 commit 0c2f550ebd3365a07a90b1332609fe6ebbdcddc9 @substack committed Feb 22, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 index.js
View
4 index.js
@@ -98,10 +98,10 @@ exports.stringify = function (op, sep, cl) {
, ended = false
, anyData = false
stream.write = function (data) {
+ anyData = true
var json = JSON.stringify(data)
if(first) { first = false ; stream.emit('data', op + json)}
else stream.emit('data', sep + json)
- anyData = true
}
stream.end = function (data) {
if(ended)
@@ -139,10 +139,10 @@ exports.stringifyObject = function (op, sep, cl) {
, ended = false
, anyData = false
stream.write = function (data) {
+ anyData = true
var json = JSON.stringify(data[0]) + ':' + JSON.stringify(data[1])
if(first) { first = false ; stream.emit('data', op + json)}
else stream.emit('data', sep + json)
- anyData = true
}
stream.end = function (data) {
if(ended) return

0 comments on commit 0c2f550

Please sign in to comment.
Something went wrong with that request. Please try again.