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.2KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. * ```javascript
  11. * of(5, 4, 7, 2, 8).pipe(
  12. * min(),
  13. * )
  14. * .subscribe(x => console.log(x)); // -> 2
  15. * ```
  16. *
  17. * Use a comparer function to get the minimal item
  18. * ```typescript
  19. * interface Person {
  20. * age: number,
  21. * name: string
  22. * }
  23. * of<Person>(
  24. * {age: 7, name: 'Foo'},
  25. * {age: 5, name: 'Bar'},
  26. * {age: 9, name: 'Beer'},
  27. * ).pipe(
  28. * min<Person>( (a: Person, b: Person) => a.age < b.age ? -1 : 1),
  29. * )
  30. * .subscribe((x: Person) => console.log(x.name)); // -> 'Bar'
  31. * ```
  32. * @see {@link max}
  33. *
  34. * @param {Function} [comparer] - Optional comparer function that it will use instead of its default to compare the
  35. * value of two items.
  36. * @return {Observable<R>} An Observable that emits item with the smallest value.
  37. * @method min
  38. * @owner Observable
  39. */
  40. export declare function min<T>(comparer?: (x: T, y: T) => number): MonoTypeOperatorFunction<T>;