UNPKG

stromjs

Version:

Dependency-free streams utils for Node.js

21 lines (20 loc) 480 B
"use strict"; exports.__esModule = true; exports.fromArray = void 0; var stream_1 = require("stream"); function fromArray(array) { var cursor = 0; return new stream_1.Readable({ objectMode: true, read: function () { if (cursor < array.length) { this.push(array[cursor]); cursor++; } else { this.push(null); } } }); } exports.fromArray = fromArray;