1 /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
2 import * as tslib_1 from "tslib";
3 import { Subscriber } from '../Subscriber';
4 export function sequenceEqual(compareTo, comparator) {
5 return function (source) { return source.lift(new SequenceEqualOperator(compareTo, comparator)); };
7 var SequenceEqualOperator = /*@__PURE__*/ (function () {
8 function SequenceEqualOperator(compareTo, comparator) {
9 this.compareTo = compareTo;
10 this.comparator = comparator;
12 SequenceEqualOperator.prototype.call = function (subscriber, source) {
13 return source.subscribe(new SequenceEqualSubscriber(subscriber, this.compareTo, this.comparator));
15 return SequenceEqualOperator;
17 export { SequenceEqualOperator };
18 var SequenceEqualSubscriber = /*@__PURE__*/ (function (_super) {
19 tslib_1.__extends(SequenceEqualSubscriber, _super);
20 function SequenceEqualSubscriber(destination, compareTo, comparator) {
21 var _this = _super.call(this, destination) || this;
22 _this.compareTo = compareTo;
23 _this.comparator = comparator;
26 _this._oneComplete = false;
27 _this.destination.add(compareTo.subscribe(new SequenceEqualCompareToSubscriber(destination, _this)));
30 SequenceEqualSubscriber.prototype._next = function (value) {
31 if (this._oneComplete && this._b.length === 0) {
39 SequenceEqualSubscriber.prototype._complete = function () {
40 if (this._oneComplete) {
41 this.emit(this._a.length === 0 && this._b.length === 0);
44 this._oneComplete = true;
48 SequenceEqualSubscriber.prototype.checkValues = function () {
49 var _c = this, _a = _c._a, _b = _c._b, comparator = _c.comparator;
50 while (_a.length > 0 && _b.length > 0) {
55 areEqual = comparator ? comparator(a, b) : a === b;
58 this.destination.error(e);
65 SequenceEqualSubscriber.prototype.emit = function (value) {
66 var destination = this.destination;
67 destination.next(value);
68 destination.complete();
70 SequenceEqualSubscriber.prototype.nextB = function (value) {
71 if (this._oneComplete && this._a.length === 0) {
79 SequenceEqualSubscriber.prototype.completeB = function () {
80 if (this._oneComplete) {
81 this.emit(this._a.length === 0 && this._b.length === 0);
84 this._oneComplete = true;
87 return SequenceEqualSubscriber;
89 export { SequenceEqualSubscriber };
90 var SequenceEqualCompareToSubscriber = /*@__PURE__*/ (function (_super) {
91 tslib_1.__extends(SequenceEqualCompareToSubscriber, _super);
92 function SequenceEqualCompareToSubscriber(destination, parent) {
93 var _this = _super.call(this, destination) || this;
94 _this.parent = parent;
97 SequenceEqualCompareToSubscriber.prototype._next = function (value) {
98 this.parent.nextB(value);
100 SequenceEqualCompareToSubscriber.prototype._error = function (err) {
101 this.parent.error(err);
104 SequenceEqualCompareToSubscriber.prototype._complete = function () {
105 this.parent.completeB();
108 return SequenceEqualCompareToSubscriber;
110 //# sourceMappingURL=sequenceEqual.js.map