node/test/common/arraystream.js
Rich Trott c506660f32 test: put common lint exceptions into config file
For lint exceptions that are universal or near universal for
`test/common`, put the exceptions in a config file rather than disabling
the ESLint rules at the top of each file.

PR-URL: https://github.com/nodejs/node/pull/39358
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
2021-07-13 17:49:31 -07:00

24 lines
578 B
JavaScript

'use strict';
const { Stream } = require('stream');
function noop() {}
// A stream to push an array into a REPL
function ArrayStream() {
this.run = function(data) {
data.forEach((line) => {
this.emit('data', `${line}\n`);
});
};
}
Object.setPrototypeOf(ArrayStream.prototype, Stream.prototype);
Object.setPrototypeOf(ArrayStream, Stream);
ArrayStream.prototype.readable = true;
ArrayStream.prototype.writable = true;
ArrayStream.prototype.pause = noop;
ArrayStream.prototype.resume = noop;
ArrayStream.prototype.write = noop;
module.exports = ArrayStream;