a zip code crypto-currency system good for red ONLY

map.js 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { map as higherOrderMap } from '../operators/map';
  2. /**
  3. * Applies a given `project` function to each value emitted by the source
  4. * Observable, and emits the resulting values as an Observable.
  5. *
  6. * <span class="informal">Like [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map),
  7. * it passes each source value through a transformation function to get
  8. * corresponding output values.</span>
  9. *
  10. * <img src="./img/map.png" width="100%">
  11. *
  12. * Similar to the well known `Array.prototype.map` function, this operator
  13. * applies a projection to each value and emits that projection in the output
  14. * Observable.
  15. *
  16. * @example <caption>Map every click to the clientX position of that click</caption>
  17. * var clicks = Rx.Observable.fromEvent(document, 'click');
  18. * var positions = clicks.map(ev => ev.clientX);
  19. * positions.subscribe(x => console.log(x));
  20. *
  21. * @see {@link mapTo}
  22. * @see {@link pluck}
  23. *
  24. * @param {function(value: T, index: number): R} project The function to apply
  25. * to each `value` emitted by the source Observable. The `index` parameter is
  26. * the number `i` for the i-th emission that has happened since the
  27. * subscription, starting from the number `0`.
  28. * @param {any} [thisArg] An optional argument to define what `this` is in the
  29. * `project` function.
  30. * @return {Observable<R>} An Observable that emits the values from the source
  31. * Observable transformed by the given `project` function.
  32. * @method map
  33. * @owner Observable
  34. */
  35. export function map(project, thisArg) {
  36. return higherOrderMap(project, thisArg)(this);
  37. }
  38. //# sourceMappingURL=map.js.map