@reactivex/ix-esnext-esm
Version:
The Interactive Extensions for JavaScript
21 lines (19 loc) • 561 B
JavaScript
import { AsyncIterableX } from './asynciterablex';
class WhileAsyncIterable extends AsyncIterableX {
constructor(condition, source) {
super();
this._condition = condition;
this._source = source;
}
async *[Symbol.asyncIterator]() {
while (await this._condition()) {
for await (const item of this._source) {
yield item;
}
}
}
}
export function whileDo(condition, source) {
return new WhileAsyncIterable(condition, source);
}
//# sourceMappingURL=whiledo.mjs.map