[Pkg-javascript-commits] [node-stream-combiner2] 11/41: support for 0-argument combine()

Bastien Roucariès rouca at moszumanska.debian.org
Wed Sep 6 09:57:52 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-combiner2.

commit 7cb8aca2c3bdbbee2e32350e6f58fbf1235cb896
Author: James Halliday <mail at substack.net>
Date:   Thu May 8 18:32:40 2014 -0700

    support for 0-argument combine()
---
 index.js     | 15 ++++++++-------
 package.json |  3 ++-
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/index.js b/index.js
index 99cf5b6..caff1bc 100644
--- a/index.js
+++ b/index.js
@@ -1,16 +1,17 @@
 var duplexer = require('duplexer')
+var through = require('through')
 
 module.exports = function () {
-
   var streams = [].slice.call(arguments)
-    , first = streams[0]
-    , last = streams[streams.length - 1]
-    , thepipe = duplexer(first, last)
 
-  if(streams.length == 1)
+  if(streams.length == 0)
+    return through()
+  else if(streams.length == 1)
     return streams[0]
-  else if (!streams.length)
-    throw new Error('connect called with empty args')
+
+  var first = streams[0]
+    , last = streams[streams.length - 1]
+    , thepipe = duplexer(first, last)
 
   //pipe all the streams together
 
diff --git a/package.json b/package.json
index c0e9845..2e0ad97 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,8 @@
     "url": "git://github.com/dominictarr/stream-combiner.git"
   },
   "dependencies": {
-    "duplexer": "~0.1.1"
+    "duplexer": "~0.1.1",
+    "through": "~2.3.4"
   },
   "devDependencies": {
     "tape": "~2.3.0",

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



More information about the Pkg-javascript-commits mailing list