@reactivex/ix-esnext-esm
Version:
The Interactive Extensions for JavaScript
24 lines (22 loc) • 702 B
JavaScript
import { AsyncIterableX } from '../asynciterablex';
export class MapAsyncIterable extends AsyncIterableX {
constructor(source, selector, thisArg) {
super();
this._source = source;
this._selector = selector;
this._thisArg = thisArg;
}
async *[Symbol.asyncIterator]() {
let i = 0;
for await (const item of this._source) {
const result = await this._selector.call(this._thisArg, item, i++);
yield result;
}
}
}
export function map(selector, thisArg) {
return function mapOperatorFunction(source) {
return new MapAsyncIterable(source, selector, thisArg);
};
}
//# sourceMappingURL=map.mjs.map