UNPKG

iteragain

Version:

Javascript Iterable/Iterator/Generator-function utilities.

19 lines 728 B
"use strict"; /* asyncify(asyncToArray) */ /* ra(IteratorOrIterable, AsyncIteratorOrIterable) */ /* ra(toArray, asyncToArray) */ /* ra(toIterator, toAsyncIterator) */ Object.defineProperty(exports, "__esModule", { value: true }); exports.toArray = toArray; const toIterator_1 = require("./toIterator"); /** Converts an iterator or iterable into an array by iterating over all it's values and collecting them. */ function toArray(iteratorOrIterable) { const iterator = (0, toIterator_1.default)(iteratorOrIterable); const result = []; let next; while (!(next = /*i(await)*/ iterator.next()).done) result.push(next.value); return result; } exports.default = toArray; //# sourceMappingURL=toArray.js.map