a zip code crypto-currency system good for red ONLY

max.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /** PURE_IMPORTS_START .._operators_max PURE_IMPORTS_END */
  2. import { max as higherOrderMax } from '../operators/max';
  3. /**
  4. * The Max operator operates on an Observable that emits numbers (or items that can be compared with a provided function),
  5. * and when source Observable completes it emits a single item: the item with the largest value.
  6. *
  7. * <img src="./img/max.png" width="100%">
  8. *
  9. * @example <caption>Get the maximal value of a series of numbers</caption>
  10. * Rx.Observable.of(5, 4, 7, 2, 8)
  11. * .max()
  12. * .subscribe(x => console.log(x)); // -> 8
  13. *
  14. * @example <caption>Use a comparer function to get the maximal item</caption>
  15. * interface Person {
  16. * age: number,
  17. * name: string
  18. * }
  19. * Observable.of<Person>({age: 7, name: 'Foo'},
  20. * {age: 5, name: 'Bar'},
  21. * {age: 9, name: 'Beer'})
  22. * .max<Person>((a: Person, b: Person) => a.age < b.age ? -1 : 1)
  23. * .subscribe((x: Person) => console.log(x.name)); // -> 'Beer'
  24. * }
  25. *
  26. * @see {@link min}
  27. *
  28. * @param {Function} [comparer] - Optional comparer function that it will use instead of its default to compare the
  29. * value of two items.
  30. * @return {Observable} An Observable that emits item with the largest value.
  31. * @method max
  32. * @owner Observable
  33. */
  34. export function max(comparer) {
  35. return higherOrderMax(comparer)(this);
  36. }
  37. //# sourceMappingURL=max.js.map