source: trip-planner-front/node_modules/rxjs/src/internal/operators/combineLatest.ts

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

initial commit

  • Property mode set to 100644
File size: 4.3 KB
Line 
1
2import { isArray } from '../util/isArray';
3import { CombineLatestOperator } from '../observable/combineLatest';
4import { from } from '../observable/from';
5import { Observable } from '../Observable';
6import { ObservableInput, OperatorFunction } from '../types';
7
8const none = {};
9
10/* tslint:disable:max-line-length */
11/** @deprecated Deprecated in favor of static combineLatest. */
12export function combineLatest<T, R>(project: (v1: T) => R): OperatorFunction<T, R>;
13/** @deprecated Deprecated in favor of static combineLatest. */
14export function combineLatest<T, T2, R>(v2: ObservableInput<T2>, project: (v1: T, v2: T2) => R): OperatorFunction<T, R>;
15/** @deprecated Deprecated in favor of static combineLatest. */
16export function combineLatest<T, T2, T3, R>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, project: (v1: T, v2: T2, v3: T3) => R): OperatorFunction<T, R>;
17/** @deprecated Deprecated in favor of static combineLatest. */
18export function combineLatest<T, T2, T3, T4, R>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, project: (v1: T, v2: T2, v3: T3, v4: T4) => R): OperatorFunction<T, R>;
19/** @deprecated Deprecated in favor of static combineLatest. */
20export function combineLatest<T, T2, T3, T4, T5, R>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, project: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5) => R): OperatorFunction<T, R>;
21/** @deprecated Deprecated in favor of static combineLatest. */
22export function combineLatest<T, T2, T3, T4, T5, T6, R>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, v6: ObservableInput<T6>, project: (v1: T, v2: T2, v3: T3, v4: T4, v5: T5, v6: T6) => R): OperatorFunction<T, R> ;
23/** @deprecated Deprecated in favor of static combineLatest. */
24export function combineLatest<T, T2>(v2: ObservableInput<T2>): OperatorFunction<T, [T, T2]>;
25/** @deprecated Deprecated in favor of static combineLatest. */
26export function combineLatest<T, T2, T3>(v2: ObservableInput<T2>, v3: ObservableInput<T3>): OperatorFunction<T, [T, T2, T3]>;
27/** @deprecated Deprecated in favor of static combineLatest. */
28export function combineLatest<T, T2, T3, T4>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>): OperatorFunction<T, [T, T2, T3, T4]>;
29/** @deprecated Deprecated in favor of static combineLatest. */
30export function combineLatest<T, T2, T3, T4, T5>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>): OperatorFunction<T, [T, T2, T3, T4, T5]>;
31/** @deprecated Deprecated in favor of static combineLatest. */
32export function combineLatest<T, T2, T3, T4, T5, T6>(v2: ObservableInput<T2>, v3: ObservableInput<T3>, v4: ObservableInput<T4>, v5: ObservableInput<T5>, v6: ObservableInput<T6>): OperatorFunction<T, [T, T2, T3, T4, T5, T6]> ;
33/** @deprecated Deprecated in favor of static combineLatest. */
34export function combineLatest<T, R>(...observables: Array<ObservableInput<T> | ((...values: Array<T>) => R)>): OperatorFunction<T, R>;
35/** @deprecated Deprecated in favor of static combineLatest. */
36export function combineLatest<T, R>(array: ObservableInput<T>[]): OperatorFunction<T, Array<T>>;
37/** @deprecated Deprecated in favor of static combineLatest. */
38export function combineLatest<T, TOther, R>(array: ObservableInput<TOther>[], project: (v1: T, ...values: Array<TOther>) => R): OperatorFunction<T, R>;
39/* tslint:enable:max-line-length */
40
41/**
42 * @deprecated Deprecated in favor of static {@link combineLatest}.
43 */
44export function combineLatest<T, R>(...observables: Array<ObservableInput<any> |
45 Array<ObservableInput<any>> |
46 ((...values: Array<any>) => R)>): OperatorFunction<T, R> {
47 let project: (...values: Array<any>) => R = null;
48 if (typeof observables[observables.length - 1] === 'function') {
49 project = <(...values: Array<any>) => R>observables.pop();
50 }
51
52 // if the first and only other argument besides the resultSelector is an array
53 // assume it's been called with `combineLatest([obs1, obs2, obs3], project)`
54 if (observables.length === 1 && isArray(observables[0])) {
55 observables = (<any>observables[0]).slice();
56 }
57
58 return (source: Observable<T>) => source.lift.call(from([source, ...observables]), new CombineLatestOperator(project));
59}
Note: See TracBrowser for help on using the repository browser.