Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

min.d.ts 1.4KB

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