[Pkg-javascript-commits] [node-stream-splicer] 25/71: fixed the header example

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:55: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-stream-splicer.

commit 77f417aeeb9583f5a9d40a73eb6fb80e7072d66e
Author: James Halliday <mail at substack.net>
Date:   Mon Jun 9 13:49:22 2014 -0700

    fixed the header example
---
 example/header.js | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/example/header.js b/example/header.js
index b06c55e..a436f26 100644
--- a/example/header.js
+++ b/example/header.js
@@ -6,12 +6,9 @@ var split = require('split');
 var headerData = {};
 var headers = through.obj(function (buf, enc, next) {
     var line = buf.toString('utf8');
-    
-    if (line === '') { // break on \n\n
+    if (line === '') {
         this.push(headerData);
-        
-        // replace header parsing with json row parsing
-        outer.splice(0, 2, JSONStream.parse([ true ]));
+        outer.splice(1, 1, JSONStream.parse([ 'rows', true ]));
     }
     else {
         var m = /^(\S+):(.+)/.exec(line);
@@ -19,9 +16,7 @@ var headers = through.obj(function (buf, enc, next) {
         var value = m && m[2].trim();
         if (m) headerData[key] = value;
     }
-    
     next();
 });
-
 var outer = pipeline([ split(), headers, JSONStream.stringify() ]);
 process.stdin.pipe(outer).pipe(process.stdout);

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



More information about the Pkg-javascript-commits mailing list