PATH:
usr
/
local
/
lib
/
node_modules
/
ghost-cli
/
node_modules
/
rxjs
/
src
/
internal
/
util
import { ObservableInput } from '../types'; import { subscribeToArray } from './subscribeToArray'; import { subscribeToPromise } from './subscribeToPromise'; import { subscribeToIterable } from './subscribeToIterable'; import { subscribeToObservable } from './subscribeToObservable'; import { isArrayLike } from './isArrayLike'; import { isPromise } from './isPromise'; import { isObject } from './isObject'; import { iterator as Symbol_iterator } from '../symbol/iterator'; import { observable as Symbol_observable } from '../symbol/observable'; import { Subscription } from '../Subscription'; import { Subscriber } from '../Subscriber'; export const subscribeTo = <T>(result: ObservableInput<T>): (subscriber: Subscriber<T>) => Subscription | void => { if (!!result && typeof result[Symbol_observable] === 'function') { return subscribeToObservable(result as any); } else if (isArrayLike(result)) { return subscribeToArray(result); } else if (isPromise(result)) { return subscribeToPromise(result as Promise<any>); } else if (!!result && typeof result[Symbol_iterator] === 'function') { return subscribeToIterable(result as any); } else { const value = isObject(result) ? 'an invalid object' : `'${result}'`; const msg = `You provided ${value} where a stream was expected.` + ' You can provide an Observable, Promise, Array, or Iterable.'; throw new TypeError(msg); } };
[-] subscribeToResult.ts
[edit]
[-] isInteropObservable.ts
[edit]
[-] isArrayLike.ts
[edit]
[-] EmptyError.ts
[edit]
[-] subscribeToPromise.ts
[edit]
[-] isScheduler.ts
[edit]
[-] root.ts
[edit]
[+]
..
[-] applyMixins.ts
[edit]
[-] isObservable.ts
[edit]
[-] tryCatch.ts
[edit]
[-] subscribeToIterable.ts
[edit]
[-] subscribeToArray.ts
[edit]
[-] isPromise.ts
[edit]
[-] pipe.ts
[edit]
[-] identity.ts
[edit]
[-] ArgumentOutOfRangeError.ts
[edit]
[-] ObjectUnsubscribedError.ts
[edit]
[-] isIterable.ts
[edit]
[-] UnsubscriptionError.ts
[edit]
[-] not.ts
[edit]
[-] isArray.ts
[edit]
[-] isObject.ts
[edit]
[-] isNumeric.ts
[edit]
[-] isFunction.ts
[edit]
[-] noop.ts
[edit]
[-] canReportError.ts
[edit]
[-] errorObject.ts
[edit]
[-] TimeoutError.ts
[edit]
[-] isDate.ts
[edit]
[-] subscribeToObservable.ts
[edit]
[-] subscribeTo.ts
[edit]
[-] hostReportError.ts
[edit]
[-] toSubscriber.ts
[edit]
[-] Immediate.ts
[edit]