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.2KB

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