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

12345678910111213141516171819202122232425262728293031323334353637
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var Observable_1 = require("../Observable");
  4. var isPromise_1 = require("../util/isPromise");
  5. var isArrayLike_1 = require("../util/isArrayLike");
  6. var isInteropObservable_1 = require("../util/isInteropObservable");
  7. var isIterable_1 = require("../util/isIterable");
  8. var fromArray_1 = require("./fromArray");
  9. var fromPromise_1 = require("./fromPromise");
  10. var fromIterable_1 = require("./fromIterable");
  11. var fromObservable_1 = require("./fromObservable");
  12. var subscribeTo_1 = require("../util/subscribeTo");
  13. function from(input, scheduler) {
  14. if (!scheduler) {
  15. if (input instanceof Observable_1.Observable) {
  16. return input;
  17. }
  18. return new Observable_1.Observable(subscribeTo_1.subscribeTo(input));
  19. }
  20. if (input != null) {
  21. if (isInteropObservable_1.isInteropObservable(input)) {
  22. return fromObservable_1.fromObservable(input, scheduler);
  23. }
  24. else if (isPromise_1.isPromise(input)) {
  25. return fromPromise_1.fromPromise(input, scheduler);
  26. }
  27. else if (isArrayLike_1.isArrayLike(input)) {
  28. return fromArray_1.fromArray(input, scheduler);
  29. }
  30. else if (isIterable_1.isIterable(input) || typeof input === 'string') {
  31. return fromIterable_1.fromIterable(input, scheduler);
  32. }
  33. }
  34. throw new TypeError((input !== null && typeof input || input) + ' is not observable');
  35. }
  36. exports.from = from;
  37. //# sourceMappingURL=from.js.map