Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

from.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435
  1. /** PURE_IMPORTS_START _Observable,_util_isPromise,_util_isArrayLike,_util_isInteropObservable,_util_isIterable,_fromArray,_fromPromise,_fromIterable,_fromObservable,_util_subscribeTo PURE_IMPORTS_END */
  2. import { Observable } from '../Observable';
  3. import { isPromise } from '../util/isPromise';
  4. import { isArrayLike } from '../util/isArrayLike';
  5. import { isInteropObservable } from '../util/isInteropObservable';
  6. import { isIterable } from '../util/isIterable';
  7. import { fromArray } from './fromArray';
  8. import { fromPromise } from './fromPromise';
  9. import { fromIterable } from './fromIterable';
  10. import { fromObservable } from './fromObservable';
  11. import { subscribeTo } from '../util/subscribeTo';
  12. export function from(input, scheduler) {
  13. if (!scheduler) {
  14. if (input instanceof Observable) {
  15. return input;
  16. }
  17. return new Observable(subscribeTo(input));
  18. }
  19. if (input != null) {
  20. if (isInteropObservable(input)) {
  21. return fromObservable(input, scheduler);
  22. }
  23. else if (isPromise(input)) {
  24. return fromPromise(input, scheduler);
  25. }
  26. else if (isArrayLike(input)) {
  27. return fromArray(input, scheduler);
  28. }
  29. else if (isIterable(input) || typeof input === 'string') {
  30. return fromIterable(input, scheduler);
  31. }
  32. }
  33. throw new TypeError((input !== null && typeof input || input) + ' is not observable');
  34. }
  35. //# sourceMappingURL=from.js.map