This commit is contained in:
Simon Priet
2021-09-05 22:53:58 +02:00
commit 9e2991e668
17888 changed files with 1263126 additions and 0 deletions

41
node_modules/stream-splicer/test/get.js generated vendored Normal file
View File

@@ -0,0 +1,41 @@
var pipeline = require('../');
var through = require('through2');
var test = require('tape');
test('get', function (t) {
var a = through.obj();
var b = through.obj();
var c = through.obj();
var pipe = pipeline([ a, b, c ]);
t.equal(pipe.get(0), a, '0');
t.equal(pipe.get(1), b, '1');
t.equal(pipe.get(2), c, '2');
t.equal(pipe.get(3), undefined, '3');
t.equal(pipe.get(4), undefined, '4');
t.equal(pipe.get(5), undefined, '5');
t.equal(pipe.get(-1), c, '-1');
t.equal(pipe.get(-1), c, '-1');
t.equal(pipe.get(-2), b, '-2');
t.equal(pipe.get(-3), a, '-3');
t.equal(pipe.get(-4), undefined, '-4');
t.equal(pipe.get(-5), undefined, '-5');
t.end();
});
test('nested get', function (t) {
var a = through.obj();
var b = through.obj();
var c = through.obj();
var d = through.obj();
var e = through.obj();
var f = through.obj();
var g = through.obj();
var pipe = pipeline([ a, [ b, c, [ d, [ e ], f ] ], g ]);
t.equal(pipe.get(0), a);
t.equal(pipe.get(1, -1, 1, 0), e);
t.equal(pipe.get(1, 3), undefined);
t.equal(pipe.get(4, 3), undefined);
t.end();
});