Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

merge.js 1.1KB

123456789101112131415161718192021222324252627282930
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var Observable_1 = require("../Observable");
  4. var isScheduler_1 = require("../util/isScheduler");
  5. var mergeAll_1 = require("../operators/mergeAll");
  6. var fromArray_1 = require("./fromArray");
  7. function merge() {
  8. var observables = [];
  9. for (var _i = 0; _i < arguments.length; _i++) {
  10. observables[_i] = arguments[_i];
  11. }
  12. var concurrent = Number.POSITIVE_INFINITY;
  13. var scheduler = null;
  14. var last = observables[observables.length - 1];
  15. if (isScheduler_1.isScheduler(last)) {
  16. scheduler = observables.pop();
  17. if (observables.length > 1 && typeof observables[observables.length - 1] === 'number') {
  18. concurrent = observables.pop();
  19. }
  20. }
  21. else if (typeof last === 'number') {
  22. concurrent = observables.pop();
  23. }
  24. if (scheduler === null && observables.length === 1 && observables[0] instanceof Observable_1.Observable) {
  25. return observables[0];
  26. }
  27. return mergeAll_1.mergeAll(concurrent)(fromArray_1.fromArray(observables, scheduler));
  28. }
  29. exports.merge = merge;
  30. //# sourceMappingURL=merge.js.map