@reactivex/ix-esnext-esm
Version:
The Interactive Extensions for JavaScript
27 lines (25 loc) • 758 B
JavaScript
import { AsyncIterableX } from '../asynciterablex';
export class ExpandAsyncIterable extends AsyncIterableX {
constructor(source, selector) {
super();
this._source = source;
this._selector = selector;
}
async *[Symbol.asyncIterator]() {
const q = [this._source];
while (q.length > 0) {
const src = q.shift();
for await (const item of src) {
const items = await this._selector(item);
q.push(items);
yield item;
}
}
}
}
export function expand(selector) {
return function expandOperatorFunction(source) {
return new ExpandAsyncIterable(source, selector);
};
}
//# sourceMappingURL=expand.mjs.map