a zip code crypto-currency system good for red ONLY

mergeMapTo.js 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /** PURE_IMPORTS_START .._operators_mergeMapTo PURE_IMPORTS_END */
  2. import { mergeMapTo as higherOrder } from '../operators/mergeMapTo';
  3. /* tslint:enable:max-line-length */
  4. /**
  5. * Projects each source value to the same Observable which is merged multiple
  6. * times in the output Observable.
  7. *
  8. * <span class="informal">It's like {@link mergeMap}, but maps each value always
  9. * to the same inner Observable.</span>
  10. *
  11. * <img src="./img/mergeMapTo.png" width="100%">
  12. *
  13. * Maps each source value to the given Observable `innerObservable` regardless
  14. * of the source value, and then merges those resulting Observables into one
  15. * single Observable, which is the output Observable.
  16. *
  17. * @example <caption>For each click event, start an interval Observable ticking every 1 second</caption>
  18. * var clicks = Rx.Observable.fromEvent(document, 'click');
  19. * var result = clicks.mergeMapTo(Rx.Observable.interval(1000));
  20. * result.subscribe(x => console.log(x));
  21. *
  22. * @see {@link concatMapTo}
  23. * @see {@link merge}
  24. * @see {@link mergeAll}
  25. * @see {@link mergeMap}
  26. * @see {@link mergeScan}
  27. * @see {@link switchMapTo}
  28. *
  29. * @param {ObservableInput} innerObservable An Observable to replace each value from
  30. * the source Observable.
  31. * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector]
  32. * A function to produce the value on the output Observable based on the values
  33. * and the indices of the source (outer) emission and the inner Observable
  34. * emission. The arguments passed to this function are:
  35. * - `outerValue`: the value that came from the source
  36. * - `innerValue`: the value that came from the projected Observable
  37. * - `outerIndex`: the "index" of the value that came from the source
  38. * - `innerIndex`: the "index" of the value from the projected Observable
  39. * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input
  40. * Observables being subscribed to concurrently.
  41. * @return {Observable} An Observable that emits items from the given
  42. * `innerObservable` (and optionally transformed through `resultSelector`) every
  43. * time a value is emitted on the source Observable.
  44. * @method mergeMapTo
  45. * @owner Observable
  46. */
  47. export function mergeMapTo(innerObservable, resultSelector, concurrent) {
  48. if (concurrent === void 0) {
  49. concurrent = Number.POSITIVE_INFINITY;
  50. }
  51. return higherOrder(innerObservable, resultSelector, concurrent)(this);
  52. }
  53. //# sourceMappingURL=mergeMapTo.js.map