This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/rxjs/internal/util/subscribeTo.js

32 lines
1.4 KiB
JavaScript
Raw Normal View History

2019-08-11 18:48:02 +00:00
"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