Debian Codegraph @

node/rxjs/src/internal/util/isObservable.ts

raw
1 /** prettier */
2 import { Observable } from '../Observable';
3 import { isFunction } from './isFunction';
4
5 /**
6 * Tests to see if the object is an RxJS {@link Observable}
7 * @param obj the object to test
8 */
9 export function isObservable(obj: any): obj is Observable<unknown> {
10 // The !! is to ensure that this publicly exposed function returns
11 // `false` if something like `null` or `0` is passed.
12 return !!obj && (obj instanceof Observable || (isFunction(obj.lift) && isFunction(obj.subscribe)));
13 }