axax
Version:
A library of async iterator extensions for JavaScript including ```map```, ```reduce```, ```filter```, ```flatMap```, ```pipe``` and [more](https://github.com/jamiemccrindle/axax/blob/master/docs/API.md#functions).
17 lines (16 loc) • 417 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Turn an async iterable to a promise of an array. The promise will resolve
* only when the async iterator returns
*
* @param source an async interable
*/
async function toArray(source) {
const result = [];
for await (const item of source) {
result.push(item);
}
return result;
}
exports.toArray = toArray;