1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.readableMapToArray = void 0;
|
4 | const index_1 = require("../../index");
|
5 | /**
|
6 | * Map Readable items to array of results (in memory),
|
7 | * passing each result via `transformMap`.
|
8 | *
|
9 | * Warning! All results are stored in memory (no backpressure).
|
10 | */
|
11 | async function readableMapToArray(stream, mapper = item => item, opt) {
|
12 | const res = [];
|
13 | await (0, index_1._pipeline)([stream, (0, index_1.transformMap)(mapper, opt), (0, index_1.writablePushToArray)(res)]);
|
14 | return res;
|
15 | }
|
16 | exports.readableMapToArray = readableMapToArray;
|