[Pkg-javascript-commits] [node-jsonstream] 122/214: remove superfluous stream

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 1 12:58:49 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-jsonstream.

commit 3323885d641cef4e91f88793555e88f2a8b3c6a9
Author: James Halliday <mail at substack.net>
Date:   Fri Jun 27 10:56:33 2014 +0800

    remove superfluous stream
---
 index.js | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/index.js b/index.js
index 31c2fa5..4302c6b 100755
--- a/index.js
+++ b/index.js
@@ -1,7 +1,6 @@
 #! /usr/bin/env node
 
 var Parser = require('jsonparse')
-  , Stream = require('stream').Stream
   , through = require('through')
 
 /*
@@ -167,20 +166,19 @@ exports.stringifyObject = function (op, sep, cl, indent) {
 
   //else, what ever you like
 
-  var stream = new Stream ()
-    , first = true
+  var first = true
     , anyData = false
   stream = through(function (data) {
     anyData = true
     var json = JSON.stringify(data[0]) + ':' + JSON.stringify(data[1], null, indent)
-    if(first) { first = false ; stream.queue(op + json)}
-    else stream.queue(sep + json)
+    if(first) { first = false ; this.queue(op + json)}
+    else this.queue(sep + json)
   },
   function (data) {
-    if(!anyData) stream.queue(op)
-    stream.queue(cl)
+    if(!anyData) this.queue(op)
+    this.queue(cl)
 
-    stream.queue(null)
+    this.queue(null)
   })
 
   return stream

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-jsonstream.git



More information about the Pkg-javascript-commits mailing list