aboutsummaryrefslogtreecommitdiff
path: root/sandbox/testAppNevena/Front/node_modules/rxjs/internal/operators/mergeMap.js
diff options
context:
space:
mode:
authorDanijel Andjelkovic <adanijel99@gmail.com>2022-03-01 21:54:41 +0100
committerDanijel Andjelkovic <adanijel99@gmail.com>2022-03-01 21:54:41 +0100
commit6c8128f9fd5a5d0be115806c35a21b3d683df8d6 (patch)
treef46c2f6b3b9b294ff32bd75c08ccdc9e7a8cc4ef /sandbox/testAppNevena/Front/node_modules/rxjs/internal/operators/mergeMap.js
parent2400b84e95913665da6279114168148444b8f9ab (diff)
parent7d3640f824f46490b47bd95f1c5a16644f712068 (diff)
Merge branch 'dev' of http://gitlab.pmf.kg.ac.rs/igrannonica/neuronstellar into logo
Diffstat (limited to 'sandbox/testAppNevena/Front/node_modules/rxjs/internal/operators/mergeMap.js')
-rw-r--r--sandbox/testAppNevena/Front/node_modules/rxjs/internal/operators/mergeMap.js109
1 files changed, 109 insertions, 0 deletions
diff --git a/sandbox/testAppNevena/Front/node_modules/rxjs/internal/operators/mergeMap.js b/sandbox/testAppNevena/Front/node_modules/rxjs/internal/operators/mergeMap.js
new file mode 100644
index 00000000..a20b0559
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/rxjs/internal/operators/mergeMap.js
@@ -0,0 +1,109 @@
+"use strict";
+var __extends = (this && this.__extends) || (function () {
+ var extendStatics = function (d, b) {
+ extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return extendStatics(d, b);
+ }
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+})();
+Object.defineProperty(exports, "__esModule", { value: true });
+var map_1 = require("./map");
+var from_1 = require("../observable/from");
+var innerSubscribe_1 = require("../innerSubscribe");
+function mergeMap(project, resultSelector, concurrent) {
+ if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
+ if (typeof resultSelector === 'function') {
+ return function (source) { return source.pipe(mergeMap(function (a, i) { return from_1.from(project(a, i)).pipe(map_1.map(function (b, ii) { return resultSelector(a, b, i, ii); })); }, concurrent)); };
+ }
+ else if (typeof resultSelector === 'number') {
+ concurrent = resultSelector;
+ }
+ return function (source) { return source.lift(new MergeMapOperator(project, concurrent)); };
+}
+exports.mergeMap = mergeMap;
+var MergeMapOperator = (function () {
+ function MergeMapOperator(project, concurrent) {
+ if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
+ this.project = project;
+ this.concurrent = concurrent;
+ }
+ MergeMapOperator.prototype.call = function (observer, source) {
+ return source.subscribe(new MergeMapSubscriber(observer, this.project, this.concurrent));
+ };
+ return MergeMapOperator;
+}());
+exports.MergeMapOperator = MergeMapOperator;
+var MergeMapSubscriber = (function (_super) {
+ __extends(MergeMapSubscriber, _super);
+ function MergeMapSubscriber(destination, project, concurrent) {
+ if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
+ var _this = _super.call(this, destination) || this;
+ _this.project = project;
+ _this.concurrent = concurrent;
+ _this.hasCompleted = false;
+ _this.buffer = [];
+ _this.active = 0;
+ _this.index = 0;
+ return _this;
+ }
+ MergeMapSubscriber.prototype._next = function (value) {
+ if (this.active < this.concurrent) {
+ this._tryNext(value);
+ }
+ else {
+ this.buffer.push(value);
+ }
+ };
+ MergeMapSubscriber.prototype._tryNext = function (value) {
+ var result;
+ var index = this.index++;
+ try {
+ result = this.project(value, index);
+ }
+ catch (err) {
+ this.destination.error(err);
+ return;
+ }
+ this.active++;
+ this._innerSub(result);
+ };
+ MergeMapSubscriber.prototype._innerSub = function (ish) {
+ var innerSubscriber = new innerSubscribe_1.SimpleInnerSubscriber(this);
+ var destination = this.destination;
+ destination.add(innerSubscriber);
+ var innerSubscription = innerSubscribe_1.innerSubscribe(ish, innerSubscriber);
+ if (innerSubscription !== innerSubscriber) {
+ destination.add(innerSubscription);
+ }
+ };
+ MergeMapSubscriber.prototype._complete = function () {
+ this.hasCompleted = true;
+ if (this.active === 0 && this.buffer.length === 0) {
+ this.destination.complete();
+ }
+ this.unsubscribe();
+ };
+ MergeMapSubscriber.prototype.notifyNext = function (innerValue) {
+ this.destination.next(innerValue);
+ };
+ MergeMapSubscriber.prototype.notifyComplete = function () {
+ var buffer = this.buffer;
+ this.active--;
+ if (buffer.length > 0) {
+ this._next(buffer.shift());
+ }
+ else if (this.active === 0 && this.hasCompleted) {
+ this.destination.complete();
+ }
+ };
+ return MergeMapSubscriber;
+}(innerSubscribe_1.SimpleOuterSubscriber));
+exports.MergeMapSubscriber = MergeMapSubscriber;
+exports.flatMap = mergeMap;
+//# sourceMappingURL=mergeMap.js.map \ No newline at end of file