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

merge.js 901B

1234567891011121314151617181920212223
  1. import { Observable } from '../Observable';
  2. import { isScheduler } from '../util/isScheduler';
  3. import { mergeAll } from '../operators/mergeAll';
  4. import { fromArray } from './fromArray';
  5. export function merge(...observables) {
  6. let concurrent = Number.POSITIVE_INFINITY;
  7. let scheduler = null;
  8. let last = observables[observables.length - 1];
  9. if (isScheduler(last)) {
  10. scheduler = observables.pop();
  11. if (observables.length > 1 && typeof observables[observables.length - 1] === 'number') {
  12. concurrent = observables.pop();
  13. }
  14. }
  15. else if (typeof last === 'number') {
  16. concurrent = observables.pop();
  17. }
  18. if (scheduler === null && observables.length === 1 && observables[0] instanceof Observable) {
  19. return observables[0];
  20. }
  21. return mergeAll(concurrent)(fromArray(observables, scheduler));
  22. }
  23. //# sourceMappingURL=merge.js.map