UNPKG

@reactivex/ix-esnext-esm

Version:

The Interactive Extensions for JavaScript

24 lines (22 loc) 679 B
import { IterableX } from '../iterablex'; import { bindCallback } from '../../util/bindcallback'; export class FlatMapIterable extends IterableX { constructor(source, fn) { super(); this._source = source; this._fn = fn; } *[Symbol.iterator]() { for (const outerItem of this._source) { for (const innerItem of this._fn(outerItem)) { yield innerItem; } } } } export function flatMap(selector, thisArg) { return function flatMapOperatorFunction(source) { return new FlatMapIterable(source, bindCallback(selector, thisArg, 1)); }; } //# sourceMappingURL=flatmap.mjs.map