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 distinctUntilChanged(compare, keySelector) {
18 return function (source) { return source.lift(new DistinctUntilChangedOperator(compare, keySelector)); };
20 exports.distinctUntilChanged = distinctUntilChanged;
21 var DistinctUntilChangedOperator = (function () {
22 function DistinctUntilChangedOperator(compare, keySelector) {
23 this.compare = compare;
24 this.keySelector = keySelector;
26 DistinctUntilChangedOperator.prototype.call = function (subscriber, source) {
27 return source.subscribe(new DistinctUntilChangedSubscriber(subscriber, this.compare, this.keySelector));
29 return DistinctUntilChangedOperator;
31 var DistinctUntilChangedSubscriber = (function (_super) {
32 __extends(DistinctUntilChangedSubscriber, _super);
33 function DistinctUntilChangedSubscriber(destination, compare, keySelector) {
34 var _this = _super.call(this, destination) || this;
35 _this.keySelector = keySelector;
37 if (typeof compare === 'function') {
38 _this.compare = compare;
42 DistinctUntilChangedSubscriber.prototype.compare = function (x, y) {
45 DistinctUntilChangedSubscriber.prototype._next = function (value) {
48 var keySelector = this.keySelector;
49 key = keySelector ? keySelector(value) : value;
52 return this.destination.error(err);
57 var compare = this.compare;
58 result = compare(this.key, key);
61 return this.destination.error(err);
69 this.destination.next(value);
72 return DistinctUntilChangedSubscriber;
73 }(Subscriber_1.Subscriber));
74 //# sourceMappingURL=distinctUntilChanged.js.map