[Pkg-javascript-commits] [node-stream-splicer] 53/71: passing nested get test

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

commit 9e09f6f297e32fcc17352781b8cd0da8075ec890
Author: James Halliday <mail at substack.net>
Date:   Sat Jun 14 19:50:28 2014 -0700

    passing nested get test
---
 index.js | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/index.js b/index.js
index 4be5d21..fc9ea1c 100644
--- a/index.js
+++ b/index.js
@@ -158,11 +158,22 @@ Pipeline.prototype.splice = function (start, removeLen) {
     return removed;
 };
 
-Pipeline.prototype.get = function (index) {
-    if (index < 0) {
-        return this._streams[this._streams.length + index];
+Pipeline.prototype.get = function () {
+    if (arguments.length === 0) return undefined;
+    
+    var base = this._streams;
+    for (var i = 0; i < arguments.length; i++) {
+        var index = arguments[i];
+        if (index < 0) {
+            base = base[base.length + index];
+        }
+        else {
+            base = base[index];
+        }
+        if (!base) return undefined;
+        if (base._streams) base = base._streams;
     }
-    else return this._streams[index];
+    return base;
 };
 
 Pipeline.prototype.indexOf = function (stream) {

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