[Pkg-javascript-commits] [node-stream-splicer] 21/71: splice-based pop() works

Bastien Roucariès rouca at moszumanska.debian.org
Fri Dec 15 09:55:48 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 79626e9cf857cad7af68c3272f0ebbf6d8dafe73
Author: James Halliday <mail at substack.net>
Date:   Sun Jun 8 14:38:05 2014 -0700

    splice-based pop() works
---
 index.js | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/index.js b/index.js
index a97ccfc..9ef1eda 100644
--- a/index.js
+++ b/index.js
@@ -75,12 +75,7 @@ Pipeline.prototype.push = function (stream) {
 };
 
 Pipeline.prototype.pop = function () {
-    var s = this._streams.pop();
-    if (this._streams.length > 0) {
-        this._streams[this._streams.length-1].unpipe(s);
-    }
-    this.emit('_mutate');
-    return s;
+    return this.splice(this._streams.length-1,1)[0];
 };
 
 Pipeline.prototype.shift = function () {
@@ -129,7 +124,7 @@ Pipeline.prototype.splice = function (start, removeLen) {
     if (reps.length && self._streams[end]) {
         reps[reps.length-1].pipe(self._streams[end]);
     }
-    if (self._streams[start-1]) {
+    if (reps[0] && self._streams[start-1]) {
         self._streams[start-1].pipe(reps[0]);
     }
     

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