mergeMap.js 692 B

123456789101112131415
  1. import { map } from './map';
  2. import { innerFrom } from '../observable/innerFrom';
  3. import { operate } from '../util/lift';
  4. import { mergeInternals } from './mergeInternals';
  5. import { isFunction } from '../util/isFunction';
  6. export function mergeMap(project, resultSelector, concurrent = Infinity) {
  7. if (isFunction(resultSelector)) {
  8. return mergeMap((a, i) => map((b, ii) => resultSelector(a, b, i, ii))(innerFrom(project(a, i))), concurrent);
  9. }
  10. else if (typeof resultSelector === 'number') {
  11. concurrent = resultSelector;
  12. }
  13. return operate((source, subscriber) => mergeInternals(source, subscriber, project, concurrent));
  14. }
  15. //# sourceMappingURL=mergeMap.js.map