Front end of the Slack clone application.

min.d.ts 1.3KB

12345678910111213141516171819202122232425262728293031323334
  1. import { Observable } from '../Observable';
  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. * <img src="./img/min.png" width="100%">
  7. *
  8. * @example <caption>Get the minimal value of a series of numbers</caption>
  9. * Rx.Observable.of(5, 4, 7, 2, 8)
  10. * .min()
  11. * .subscribe(x => console.log(x)); // -> 2
  12. *
  13. * @example <caption>Use a comparer function to get the minimal item</caption>
  14. * interface Person {
  15. * age: number,
  16. * name: string
  17. * }
  18. * Observable.of<Person>({age: 7, name: 'Foo'},
  19. * {age: 5, name: 'Bar'},
  20. * {age: 9, name: 'Beer'})
  21. * .min<Person>( (a: Person, b: Person) => a.age < b.age ? -1 : 1)
  22. * .subscribe((x: Person) => console.log(x.name)); // -> 'Bar'
  23. * }
  24. *
  25. * @see {@link max}
  26. *
  27. * @param {Function} [comparer] - Optional comparer function that it will use instead of its default to compare the
  28. * value of two items.
  29. * @return {Observable<R>} An Observable that emits item with the smallest value.
  30. * @method min
  31. * @owner Observable
  32. */
  33. export declare function min<T>(this: Observable<T>, comparer?: (x: T, y: T) => number): Observable<T>;