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).
18 lines (17 loc) • 425 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/**
* Helper function to turn an iterator into an iterable
*
* @param iterator An iteratable
*/
async function* iteratorToIterable(iterator) {
while (true) {
const next = await iterator.next();
if (next.done) {
return;
}
yield next.value;
}
}
exports.iteratorToIterable = iteratorToIterable;