UNPKG

474 BJavaScriptView Raw
1import { AsyncIterableX } from './asynciterablex';
2class AnonymousAsyncIterable extends AsyncIterableX {
3 constructor(fn) {
4 super();
5 this._fn = fn;
6 }
7 async *[Symbol.asyncIterator]() {
8 const it = await this._fn();
9 let next;
10 while (!(next = await it.next()).done) {
11 yield next.value;
12 }
13 }
14}
15export function create(fn) {
16 return new AnonymousAsyncIterable(fn);
17}
18
19//# sourceMappingURL=create.mjs.map