shelving
Version:
Toolkit for using data in JavaScript.
20 lines (19 loc) • 597 B
JavaScript
import { AbstractIterator } from "./AbstractIterator.js";
/** Iterable that pulls values from a source iterable. */
export class ThroughIterator extends AbstractIterator {
_source;
constructor(iterator) {
super();
this._source = iterator;
}
// Implement `AbstractIterator`
next(value) {
return this._source.next(value);
}
throw(thrown) {
return this._source.throw ? this._source.throw(thrown) : super.throw(thrown);
}
return(value) {
return this._source.return ? this._source.return(value) : super.return(value);
}
}