a zip code crypto-currency system good for red ONLY

find.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { find as higherOrder } from '../operators/find';
  2. /* tslint:enable:max-line-length */
  3. /**
  4. * Emits only the first value emitted by the source Observable that meets some
  5. * condition.
  6. *
  7. * <span class="informal">Finds the first value that passes some test and emits
  8. * that.</span>
  9. *
  10. * <img src="./img/find.png" width="100%">
  11. *
  12. * `find` searches for the first item in the source Observable that matches the
  13. * specified condition embodied by the `predicate`, and returns the first
  14. * occurrence in the source. Unlike {@link first}, the `predicate` is required
  15. * in `find`, and does not emit an error if a valid value is not found.
  16. *
  17. * @example <caption>Find and emit the first click that happens on a DIV element</caption>
  18. * var clicks = Rx.Observable.fromEvent(document, 'click');
  19. * var result = clicks.find(ev => ev.target.tagName === 'DIV');
  20. * result.subscribe(x => console.log(x));
  21. *
  22. * @see {@link filter}
  23. * @see {@link first}
  24. * @see {@link findIndex}
  25. * @see {@link take}
  26. *
  27. * @param {function(value: T, index: number, source: Observable<T>): boolean} predicate
  28. * A function called with each item to test for condition matching.
  29. * @param {any} [thisArg] An optional argument to determine the value of `this`
  30. * in the `predicate` function.
  31. * @return {Observable<T>} An Observable of the first item that matches the
  32. * condition.
  33. * @method find
  34. * @owner Observable
  35. */
  36. export function find(predicate, thisArg) {
  37. return higherOrder(predicate, thisArg)(this);
  38. }
  39. //# sourceMappingURL=find.js.map