a zip code crypto-currency system good for red ONLY

mapTo.js 1.1KB

12345678910111213141516171819202122232425262728293031
  1. import { mapTo as higherOrder } from '../operators/mapTo';
  2. /**
  3. * Emits the given constant value on the output Observable every time the source
  4. * Observable emits a value.
  5. *
  6. * <span class="informal">Like {@link map}, but it maps every source value to
  7. * the same output value every time.</span>
  8. *
  9. * <img src="./img/mapTo.png" width="100%">
  10. *
  11. * Takes a constant `value` as argument, and emits that whenever the source
  12. * Observable emits a value. In other words, ignores the actual source value,
  13. * and simply uses the emission moment to know when to emit the given `value`.
  14. *
  15. * @example <caption>Map every click to the string 'Hi'</caption>
  16. * var clicks = Rx.Observable.fromEvent(document, 'click');
  17. * var greetings = clicks.mapTo('Hi');
  18. * greetings.subscribe(x => console.log(x));
  19. *
  20. * @see {@link map}
  21. *
  22. * @param {any} value The value to map each source value to.
  23. * @return {Observable} An Observable that emits the given `value` every time
  24. * the source Observable emits something.
  25. * @method mapTo
  26. * @owner Observable
  27. */
  28. export function mapTo(value) {
  29. return higherOrder(value)(this);
  30. }
  31. //# sourceMappingURL=mapTo.js.map