aboutsummaryrefslogtreecommitdiff
path: root/sandbox/testAppNevena/Front/node_modules/rxjs/internal/operators/single.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/single.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/single.js')
-rw-r--r--sandbox/testAppNevena/Front/node_modules/rxjs/internal/operators/single.js82
1 files changed, 82 insertions, 0 deletions
diff --git a/sandbox/testAppNevena/Front/node_modules/rxjs/internal/operators/single.js b/sandbox/testAppNevena/Front/node_modules/rxjs/internal/operators/single.js
new file mode 100644
index 00000000..b99c2d8c
--- /dev/null
+++ b/sandbox/testAppNevena/Front/node_modules/rxjs/internal/operators/single.js
@@ -0,0 +1,82 @@
+"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 Subscriber_1 = require("../Subscriber");
+var EmptyError_1 = require("../util/EmptyError");
+function single(predicate) {
+ return function (source) { return source.lift(new SingleOperator(predicate, source)); };
+}
+exports.single = single;
+var SingleOperator = (function () {
+ function SingleOperator(predicate, source) {
+ this.predicate = predicate;
+ this.source = source;
+ }
+ SingleOperator.prototype.call = function (subscriber, source) {
+ return source.subscribe(new SingleSubscriber(subscriber, this.predicate, this.source));
+ };
+ return SingleOperator;
+}());
+var SingleSubscriber = (function (_super) {
+ __extends(SingleSubscriber, _super);
+ function SingleSubscriber(destination, predicate, source) {
+ var _this = _super.call(this, destination) || this;
+ _this.predicate = predicate;
+ _this.source = source;
+ _this.seenValue = false;
+ _this.index = 0;
+ return _this;
+ }
+ SingleSubscriber.prototype.applySingleValue = function (value) {
+ if (this.seenValue) {
+ this.destination.error('Sequence contains more than one element');
+ }
+ else {
+ this.seenValue = true;
+ this.singleValue = value;
+ }
+ };
+ SingleSubscriber.prototype._next = function (value) {
+ var index = this.index++;
+ if (this.predicate) {
+ this.tryNext(value, index);
+ }
+ else {
+ this.applySingleValue(value);
+ }
+ };
+ SingleSubscriber.prototype.tryNext = function (value, index) {
+ try {
+ if (this.predicate(value, index, this.source)) {
+ this.applySingleValue(value);
+ }
+ }
+ catch (err) {
+ this.destination.error(err);
+ }
+ };
+ SingleSubscriber.prototype._complete = function () {
+ var destination = this.destination;
+ if (this.index > 0) {
+ destination.next(this.seenValue ? this.singleValue : undefined);
+ destination.complete();
+ }
+ else {
+ destination.error(new EmptyError_1.EmptyError);
+ }
+ };
+ return SingleSubscriber;
+}(Subscriber_1.Subscriber));
+//# sourceMappingURL=single.js.map \ No newline at end of file