30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
var Observable_1 = require("../Observable");
|
|
var isScheduler_1 = require("../util/isScheduler");
|
|
var mergeAll_1 = require("../operators/mergeAll");
|
|
var fromArray_1 = require("./fromArray");
|
|
function merge() {
|
|
var observables = [];
|
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
observables[_i] = arguments[_i];
|
|
}
|
|
var concurrent = Number.POSITIVE_INFINITY;
|
|
var scheduler = null;
|
|
var last = observables[observables.length - 1];
|
|
if (isScheduler_1.isScheduler(last)) {
|
|
scheduler = observables.pop();
|
|
if (observables.length > 1 && typeof observables[observables.length - 1] === 'number') {
|
|
concurrent = observables.pop();
|
|
}
|
|
}
|
|
else if (typeof last === 'number') {
|
|
concurrent = observables.pop();
|
|
}
|
|
if (scheduler === null && observables.length === 1 && observables[0] instanceof Observable_1.Observable) {
|
|
return observables[0];
|
|
}
|
|
return mergeAll_1.mergeAll(concurrent)(fromArray_1.fromArray(observables, scheduler));
|
|
}
|
|
exports.merge = merge;
|
|
//# sourceMappingURL=merge.js.map
|