UNPKG

460 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 let it = await this._fn(), next;
9 while (!(next = await it.next()).done) {
10 yield next.value;
11 }
12 }
13}
14export function create(fn) {
15 return new AnonymousAsyncIterable(fn);
16}
17
18//# sourceMappingURL=create.mjs.map