github-pages-deploy-action/node_modules/rxjs/internal/util/subscribeTo.js
2020-03-06 22:45:40 -05:00

32 lines
1.4 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var subscribeToArray_1 = require("./subscribeToArray");
var subscribeToPromise_1 = require("./subscribeToPromise");
var subscribeToIterable_1 = require("./subscribeToIterable");
var subscribeToObservable_1 = require("./subscribeToObservable");
var isArrayLike_1 = require("./isArrayLike");
var isPromise_1 = require("./isPromise");
var isObject_1 = require("./isObject");
var iterator_1 = require("../symbol/iterator");
var observable_1 = require("../symbol/observable");
exports.subscribeTo = function (result) {
if (!!result && typeof result[observable_1.observable] === 'function') {
return subscribeToObservable_1.subscribeToObservable(result);
}
else if (isArrayLike_1.isArrayLike(result)) {
return subscribeToArray_1.subscribeToArray(result);
}
else if (isPromise_1.isPromise(result)) {
return subscribeToPromise_1.subscribeToPromise(result);
}
else if (!!result && typeof result[iterator_1.iterator] === 'function') {
return subscribeToIterable_1.subscribeToIterable(result);
}
else {
var value = isObject_1.isObject(result) ? 'an invalid object' : "'" + result + "'";
var msg = "You provided " + value + " where a stream was expected."
+ ' You can provide an Observable, Promise, Array, or Iterable.';
throw new TypeError(msg);
}
};
//# sourceMappingURL=subscribeTo.js.map