source: trip-planner-front/node_modules/rxjs/internal/operators/min.d.ts@ 571e0df

Last change on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.4 KB
Line 
1import { 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 */
46export declare function min<T>(comparer?: (x: T, y: T) => number): MonoTypeOperatorFunction<T>;
Note: See TracBrowser for help on using the repository browser.