a zip code crypto-currency system good for red ONLY

take.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { take as higherOrder } from '../operators/take';
  2. /**
  3. * Emits only the first `count` values emitted by the source Observable.
  4. *
  5. * <span class="informal">Takes the first `count` values from the source, then
  6. * completes.</span>
  7. *
  8. * <img src="./img/take.png" width="100%">
  9. *
  10. * `take` returns an Observable that emits only the first `count` values emitted
  11. * by the source Observable. If the source emits fewer than `count` values then
  12. * all of its values are emitted. After that, it completes, regardless if the
  13. * source completes.
  14. *
  15. * @example <caption>Take the first 5 seconds of an infinite 1-second interval Observable</caption>
  16. * var interval = Rx.Observable.interval(1000);
  17. * var five = interval.take(5);
  18. * five.subscribe(x => console.log(x));
  19. *
  20. * @see {@link takeLast}
  21. * @see {@link takeUntil}
  22. * @see {@link takeWhile}
  23. * @see {@link skip}
  24. *
  25. * @throws {ArgumentOutOfRangeError} When using `take(i)`, it delivers an
  26. * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0`.
  27. *
  28. * @param {number} count The maximum number of `next` values to emit.
  29. * @return {Observable<T>} An Observable that emits only the first `count`
  30. * values emitted by the source Observable, or all of the values from the source
  31. * if the source emits fewer than `count` values.
  32. * @method take
  33. * @owner Observable
  34. */
  35. export function take(count) {
  36. return higherOrder(count)(this);
  37. }
  38. //# sourceMappingURL=take.js.map