mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
Manually fix issues that eslint --fix couldn't do automatically. Backport-PR-URL: https://github.com/nodejs/node/pull/11775 PR-URL: https://github.com/nodejs/node/pull/10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
34 lines
704 B
JavaScript
34 lines
704 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const assert = require('assert');
|
|
|
|
const stream = require('stream');
|
|
const PassThrough = stream.PassThrough;
|
|
|
|
const src = new PassThrough({ objectMode: true });
|
|
const tx = new PassThrough({ objectMode: true });
|
|
const dest = new PassThrough({ objectMode: true });
|
|
|
|
const expect = [ -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
|
|
const results = [];
|
|
process.on('exit', function() {
|
|
assert.deepStrictEqual(results, expect);
|
|
console.log('ok');
|
|
});
|
|
|
|
dest.on('data', function(x) {
|
|
results.push(x);
|
|
});
|
|
|
|
src.pipe(tx).pipe(dest);
|
|
|
|
let i = -1;
|
|
const int = setInterval(function() {
|
|
if (i > 10) {
|
|
src.end();
|
|
clearInterval(int);
|
|
} else {
|
|
src.write(i++);
|
|
}
|
|
}, 1);
|