29a02176b8833aeea1584be077599e7ee3db017a78c88ba436795c3fc49c4cbc6483c76ca5ce15d240d830384446a153e3032acaacdbd5faeb3b0c03f1bae5 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { MonoTypeOperatorFunction } from '../types';
  2. /**
  3. * The `min` operator operates on an Observable that emits numbers (or items that
  4. * can be compared with a provided function), and when source Observable completes
  5. * it emits a single item: the item with the smallest value.
  6. *
  7. * ![](min.png)
  8. *
  9. * ## Examples
  10. *
  11. * Get the minimal value of a series of numbers
  12. *
  13. * ```ts
  14. * import { of, min } from 'rxjs';
  15. *
  16. * of(5, 4, 7, 2, 8)
  17. * .pipe(min())
  18. * .subscribe(x => console.log(x));
  19. *
  20. * // Outputs
  21. * // 2
  22. * ```
  23. *
  24. * Use a comparer function to get the minimal item
  25. *
  26. * ```ts
  27. * import { of, min } from 'rxjs';
  28. *
  29. * of(
  30. * { age: 7, name: 'Foo' },
  31. * { age: 5, name: 'Bar' },
  32. * { age: 9, name: 'Beer' }
  33. * ).pipe(
  34. * min((a, b) => a.age < b.age ? -1 : 1)
  35. * )
  36. * .subscribe(x => console.log(x.name));
  37. *
  38. * // Outputs
  39. * // 'Bar'
  40. * ```
  41. *
  42. * @see {@link max}
  43. *
  44. * @param comparer Optional comparer function that it will use instead of its
  45. * default to compare the value of two items.
  46. * @return A function that returns an Observable that emits item with the
  47. * smallest value.
  48. */
  49. export declare function min<T>(comparer?: (x: T, y: T) => number): MonoTypeOperatorFunction<T>;
  50. //# sourceMappingURL=min.d.ts.map