a zip code crypto-currency system good for red ONLY

map.js 1.6KB

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