source: trip-planner-front/node_modules/rxjs/_esm2015/internal/util/subscribeTo.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[6a3a178]1import { subscribeToArray } from './subscribeToArray';
2import { subscribeToPromise } from './subscribeToPromise';
3import { subscribeToIterable } from './subscribeToIterable';
4import { subscribeToObservable } from './subscribeToObservable';
5import { isArrayLike } from './isArrayLike';
6import { isPromise } from './isPromise';
7import { isObject } from './isObject';
8import { iterator as Symbol_iterator } from '../symbol/iterator';
9import { observable as Symbol_observable } from '../symbol/observable';
10export const subscribeTo = (result) => {
11 if (!!result && typeof result[Symbol_observable] === 'function') {
12 return subscribeToObservable(result);
13 }
14 else if (isArrayLike(result)) {
15 return subscribeToArray(result);
16 }
17 else if (isPromise(result)) {
18 return subscribeToPromise(result);
19 }
20 else if (!!result && typeof result[Symbol_iterator] === 'function') {
21 return subscribeToIterable(result);
22 }
23 else {
24 const value = isObject(result) ? 'an invalid object' : `'${result}'`;
25 const msg = `You provided ${value} where a stream was expected.`
26 + ' You can provide an Observable, Promise, Array, or Iterable.';
27 throw new TypeError(msg);
28 }
29};
30//# sourceMappingURL=subscribeTo.js.map
Note: See TracBrowser for help on using the repository browser.