UNPKG

iteragain

Version:

Javascript Iterable/Iterator/Generator-function utilities.

16 lines 578 B
import toIterator from './toIterator'; import toIterableIterator from './toIterableIterator'; /** * Reverses the input iterator's order. Note that in order to reverse, it will attempt to iterate fully once, which * could cause significant memory usage. So because of this, only use on finite iterators. */ export function reverse(arg) { var next; var it = toIterator(arg); var result = []; while (!(next = it.next()).done) result.unshift(next.value); return toIterableIterator(result); } export default reverse; //# sourceMappingURL=reverse.js.map