UNPKG

@reactivex/ix-esnext-esm

Version:

The Interactive Extensions for JavaScript

23 lines (21 loc) 630 B
import { IterableX } from '../iterablex'; import { bindCallback } from '../../util/bindcallback'; export class MapIterable extends IterableX { constructor(source, selector) { super(); this._source = source; this._selector = selector; } *[Symbol.iterator]() { let i = 0; for (const item of this._source) { yield this._selector(item, i++); } } } export function map(selector, thisArg) { return function mapOperatorFunction(source) { return new MapIterable(source, bindCallback(selector, thisArg, 2)); }; } //# sourceMappingURL=map.mjs.map