wishthis/node_modules/rxjs/_esm5/internal/util/subscribeTo.js
2022-05-29 11:24:36 +02:00

31 lines
1.5 KiB
JavaScript

/** PURE_IMPORTS_START _subscribeToArray,_subscribeToPromise,_subscribeToIterable,_subscribeToObservable,_isArrayLike,_isPromise,_isObject,_symbol_iterator,_symbol_observable PURE_IMPORTS_END */
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';
export var subscribeTo = function (result) {
if (!!result && typeof result[Symbol_observable] === 'function') {
return subscribeToObservable(result);
}
else if (isArrayLike(result)) {
return subscribeToArray(result);
}
else if (isPromise(result)) {
return subscribeToPromise(result);
}
else if (!!result && typeof result[Symbol_iterator] === 'function') {
return subscribeToIterable(result);
}
else {
var value = 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