iteragain
Version:
Javascript Iterable/Iterator/Generator-function utilities.
20 lines • 582 B
JavaScript
export class TeedIterator {
constructor(i, seekable, indices) {
this.i = i;
this.seekable = seekable;
this.indices = indices;
}
[Symbol.iterator]() {
return this;
}
next() {
this.seekable.seek(this.indices[this.i] + 1);
const value = this.seekable.elements[this.indices[this.i]];
if (value === undefined)
return { done: true, value: undefined };
this.indices[this.i]++;
return { done: false, value };
}
}
export default TeedIterator;
//# sourceMappingURL=TeedIterator.js.map