|
12345678910111213141516171819202122232425262728293031323334 |
- import { Observable } from '../Observable';
- import { isPromise } from '../util/isPromise';
- import { isArrayLike } from '../util/isArrayLike';
- import { isInteropObservable } from '../util/isInteropObservable';
- import { isIterable } from '../util/isIterable';
- import { fromArray } from './fromArray';
- import { fromPromise } from './fromPromise';
- import { fromIterable } from './fromIterable';
- import { fromObservable } from './fromObservable';
- import { subscribeTo } from '../util/subscribeTo';
- export function from(input, scheduler) {
- if (!scheduler) {
- if (input instanceof Observable) {
- return input;
- }
- return new Observable(subscribeTo(input));
- }
- if (input != null) {
- if (isInteropObservable(input)) {
- return fromObservable(input, scheduler);
- }
- else if (isPromise(input)) {
- return fromPromise(input, scheduler);
- }
- else if (isArrayLike(input)) {
- return fromArray(input, scheduler);
- }
- else if (isIterable(input) || typeof input === 'string') {
- return fromIterable(input, scheduler);
- }
- }
- throw new TypeError((input !== null && typeof input || input) + ' is not observable');
- }
- //# sourceMappingURL=from.js.map
|