![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/dceprojects.corals.io/node_modules/stream-shift/ |
var tape = require('tape') var through = require('through2') var stream = require('stream') var shift = require('./') tape('shifts next', function (t) { var passthrough = through() passthrough.write('hello') passthrough.write('world') t.same(shift(passthrough), Buffer('hello')) t.same(shift(passthrough), Buffer('world')) t.end() }) tape('shifts next with core', function (t) { var passthrough = stream.PassThrough() passthrough.write('hello') passthrough.write('world') t.same(shift(passthrough), Buffer('hello')) t.same(shift(passthrough), Buffer('world')) t.end() }) tape('shifts next with object mode', function (t) { var passthrough = through({objectMode: true}) passthrough.write({hello: 1}) passthrough.write({world: 1}) t.same(shift(passthrough), {hello: 1}) t.same(shift(passthrough), {world: 1}) t.end() }) tape('shifts next with object mode with core', function (t) { var passthrough = stream.PassThrough({objectMode: true}) passthrough.write({hello: 1}) passthrough.write({world: 1}) t.same(shift(passthrough), {hello: 1}) t.same(shift(passthrough), {world: 1}) t.end() })