@reactivex/ix-esnext-esm
Version:
The Interactive Extensions for JavaScript
21 lines (19 loc) • 624 B
JavaScript
import { AsyncIterableX } from '../asynciterable';
import { bindCallback } from '../util/bindcallback';
class MapAsyncIterable extends AsyncIterableX {
constructor(source, selector) {
super();
this._source = source;
this._selector = selector;
}
async *[Symbol.asyncIterator]() {
let i = 0;
for await (const item of this._source) {
yield await this._selector(item, i++);
}
}
}
export function mapAsync(source, selector, thisArg) {
return new MapAsyncIterable(source, bindCallback(selector, thisArg, 2));
}
//# sourceMappingURL=mapasync.mjs.map