UNPKG

iteragain

Version:

Javascript Iterable/Iterator/Generator-function utilities.

19 lines 571 B
export class CompressIterator { constructor(iterator, selectors) { this.iterator = iterator; this.selectors = selectors; } [Symbol.iterator]() { return this; } next(...args) { const [next, selector] = [this.iterator.next(...args), this.selectors.next()]; if (next.done || selector.done) return { done: true, value: undefined }; else if (selector.value) return next; return this.next(); } } export default CompressIterator; //# sourceMappingURL=CompressIterator.js.map