a zip code crypto-currency system good for red ONLY

map.d.ts 1.9KB

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