2 var __extends = (this && this.__extends) || (function () {
3 var extendStatics = function (d, b) {
4 extendStatics = Object.setPrototypeOf ||
5 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7 return extendStatics(d, b);
9 return function (d, b) {
11 function __() { this.constructor = d; }
12 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15 Object.defineProperty(exports, "__esModule", { value: true });
16 var Subscriber_1 = require("../Subscriber");
17 function sequenceEqual(compareTo, comparator) {
18 return function (source) { return source.lift(new SequenceEqualOperator(compareTo, comparator)); };
20 exports.sequenceEqual = sequenceEqual;
21 var SequenceEqualOperator = (function () {
22 function SequenceEqualOperator(compareTo, comparator) {
23 this.compareTo = compareTo;
24 this.comparator = comparator;
26 SequenceEqualOperator.prototype.call = function (subscriber, source) {
27 return source.subscribe(new SequenceEqualSubscriber(subscriber, this.compareTo, this.comparator));
29 return SequenceEqualOperator;
31 exports.SequenceEqualOperator = SequenceEqualOperator;
32 var SequenceEqualSubscriber = (function (_super) {
33 __extends(SequenceEqualSubscriber, _super);
34 function SequenceEqualSubscriber(destination, compareTo, comparator) {
35 var _this = _super.call(this, destination) || this;
36 _this.compareTo = compareTo;
37 _this.comparator = comparator;
40 _this._oneComplete = false;
41 _this.destination.add(compareTo.subscribe(new SequenceEqualCompareToSubscriber(destination, _this)));
44 SequenceEqualSubscriber.prototype._next = function (value) {
45 if (this._oneComplete && this._b.length === 0) {
53 SequenceEqualSubscriber.prototype._complete = function () {
54 if (this._oneComplete) {
55 this.emit(this._a.length === 0 && this._b.length === 0);
58 this._oneComplete = true;
62 SequenceEqualSubscriber.prototype.checkValues = function () {
63 var _c = this, _a = _c._a, _b = _c._b, comparator = _c.comparator;
64 while (_a.length > 0 && _b.length > 0) {
69 areEqual = comparator ? comparator(a, b) : a === b;
72 this.destination.error(e);
79 SequenceEqualSubscriber.prototype.emit = function (value) {
80 var destination = this.destination;
81 destination.next(value);
82 destination.complete();
84 SequenceEqualSubscriber.prototype.nextB = function (value) {
85 if (this._oneComplete && this._a.length === 0) {
93 SequenceEqualSubscriber.prototype.completeB = function () {
94 if (this._oneComplete) {
95 this.emit(this._a.length === 0 && this._b.length === 0);
98 this._oneComplete = true;
101 return SequenceEqualSubscriber;
102 }(Subscriber_1.Subscriber));
103 exports.SequenceEqualSubscriber = SequenceEqualSubscriber;
104 var SequenceEqualCompareToSubscriber = (function (_super) {
105 __extends(SequenceEqualCompareToSubscriber, _super);
106 function SequenceEqualCompareToSubscriber(destination, parent) {
107 var _this = _super.call(this, destination) || this;
108 _this.parent = parent;
111 SequenceEqualCompareToSubscriber.prototype._next = function (value) {
112 this.parent.nextB(value);
114 SequenceEqualCompareToSubscriber.prototype._error = function (err) {
115 this.parent.error(err);
118 SequenceEqualCompareToSubscriber.prototype._complete = function () {
119 this.parent.completeB();
122 return SequenceEqualCompareToSubscriber;
123 }(Subscriber_1.Subscriber));
124 //# sourceMappingURL=sequenceEqual.js.map