12345678910111213141516171819202122232425262728293031323334353637 |
- "use strict";
- Object.defineProperty(exports, "__esModule", { value: true });
- var Observable_1 = require("../Observable");
- var isPromise_1 = require("../util/isPromise");
- var isArrayLike_1 = require("../util/isArrayLike");
- var isInteropObservable_1 = require("../util/isInteropObservable");
- var isIterable_1 = require("../util/isIterable");
- var fromArray_1 = require("./fromArray");
- var fromPromise_1 = require("./fromPromise");
- var fromIterable_1 = require("./fromIterable");
- var fromObservable_1 = require("./fromObservable");
- var subscribeTo_1 = require("../util/subscribeTo");
- function from(input, scheduler) {
- if (!scheduler) {
- if (input instanceof Observable_1.Observable) {
- return input;
- }
- return new Observable_1.Observable(subscribeTo_1.subscribeTo(input));
- }
- if (input != null) {
- if (isInteropObservable_1.isInteropObservable(input)) {
- return fromObservable_1.fromObservable(input, scheduler);
- }
- else if (isPromise_1.isPromise(input)) {
- return fromPromise_1.fromPromise(input, scheduler);
- }
- else if (isArrayLike_1.isArrayLike(input)) {
- return fromArray_1.fromArray(input, scheduler);
- }
- else if (isIterable_1.isIterable(input) || typeof input === 'string') {
- return fromIterable_1.fromIterable(input, scheduler);
- }
- }
- throw new TypeError((input !== null && typeof input || input) + ' is not observable');
- }
- exports.from = from;
- //# sourceMappingURL=from.js.map
|