[Pkg-javascript-commits] [node-stream-combiner2] 29/41: Use streams3

Bastien Roucariès rouca at moszumanska.debian.org
Wed Sep 6 09:57:53 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 5da8e716dc0164e1f5d69506dd89d82a01774759
Author: Andres Suarez <zertosh at gmail.com>
Date:   Mon Aug 24 03:37:18 2015 -0400

    Use streams3
---
 README.md    |  4 ++--
 index.js     | 12 ++++--------
 package.json |  6 +++---
 3 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/README.md b/README.md
index 5b92a87..1fc19b0 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
 
 This is a sequel to
 [stream-combiner](https://npmjs.org/package/stream-combiner)
-for streams2.
+for streams3.
 
 ``` js
 var combine = require('stream-combiner2')
@@ -13,7 +13,7 @@ var combine = require('stream-combiner2')
 Turn a pipeline into a single stream. `Combine` returns a stream that writes to the first stream
 and reads from the last stream. 
 
-Streams1 streams are automatically upgraded to be streams2 streams.
+Streams1 streams are automatically upgraded to be streams3 streams.
 
 Listening for 'error' will recieve errors from all streams inside the pipe.
 
diff --git a/index.js b/index.js
index eb185d8..d849839 100644
--- a/index.js
+++ b/index.js
@@ -1,5 +1,6 @@
+var PassThrough = require('readable-stream').PassThrough
+var Readable = require('readable-stream').Readable
 var duplexer = require('duplexer2')
-var through = require('through2')
 
 module.exports = function () {
   var streams
@@ -28,7 +29,7 @@ function combine (streams, opts) {
     streams[i] = wrap(streams[i], opts)
 
   if(streams.length == 0)
-    return through(opts)
+    return new PassThrough(opts)
   else if(streams.length == 1)
     return streams[0]
 
@@ -63,10 +64,5 @@ function combine (streams, opts) {
 
 function wrap (tr, opts) {
   if (typeof tr.read === 'function') return tr
-  if (!opts) opts = tr._options || {}
-  var input = through(opts), output = through(opts)
-  input.pipe(tr).pipe(output)
-  var dup = duplexer(input, output)
-  tr.on('error', function (err) { dup.emit('error', err) });
-  return dup;
+  return new Readable(opts).wrap(tr)
 }
diff --git a/package.json b/package.json
index f6db7b5..0f01172 100644
--- a/package.json
+++ b/package.json
@@ -7,12 +7,12 @@
     "url": "git://github.com/substack/stream-combiner2.git"
   },
   "dependencies": {
-    "duplexer2": "~0.0.2",
-    "through2": "~0.5.1"
+    "duplexer2": "~0.1.0",
+    "readable-stream": "^2.0.2"
   },
   "devDependencies": {
     "tape": "~2.3.0",
-    "through": "~2.3.4",
+    "through2": "^2.0.0",
     "event-stream": "~3.0.7"
   },
   "scripts": {

-- 
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