UNPKG

@naturalcycles/nodejs-lib

Version:
16 lines 715 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const pipeline_1 = require("./pipeline/pipeline"); const transformMap_1 = require("./transform/transformMap"); const writablePushToArray_1 = require("./writable/writablePushToArray"); /** * Map stream items to array of results (in memory). * Warning! All results are stored in memory (no backpressure). */ async function streamMapToArray(stream, mapper = item => item, opt) { const res = []; await pipeline_1._pipeline([stream, transformMap_1.transformMap(mapper, opt), writablePushToArray_1.writablePushToArray(res)]); return res; } exports.streamMapToArray = streamMapToArray; //# sourceMappingURL=streamMapToArray.js.map