UNPKG

iteragain

Version:

Javascript Iterable/Iterator/Generator-function utilities.

16 lines 619 B
/* asyncify(asyncToArray) */ /* ra(IteratorOrIterable, AsyncIteratorOrIterable) */ /* ra(toArray, asyncToArray) */ /* ra(toIterator, toAsyncIterator) */ import toIterator from './toIterator'; /** Converts an iterator or iterable into an array by iterating over all it's values and collecting them. */ export /*i(async)*/ function toArray(iteratorOrIterable) { const iterator = toIterator(iteratorOrIterable); const result = []; let next; while (!(next = /*i(await)*/ iterator.next()).done) result.push(next.value); return result; } export default toArray; //# sourceMappingURL=toArray.js.map