1 | import { AsyncIterableX } from './asynciterablex';
|
2 | class WhileAsyncIterable extends AsyncIterableX {
|
3 | constructor(condition, source) {
|
4 | super();
|
5 | this._condition = condition;
|
6 | this._source = source;
|
7 | }
|
8 | async *[Symbol.asyncIterator]() {
|
9 | while (await this._condition()) {
|
10 | for await (const item of this._source) {
|
11 | yield item;
|
12 | }
|
13 | }
|
14 | }
|
15 | }
|
16 | export function whileDo(condition, source) {
|
17 | return new WhileAsyncIterable(condition, source);
|
18 | }
|
19 |
|
20 | //# sourceMappingURL=whiledo.mjs.map
|