1 /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
2 import * as tslib_1 from "tslib";
3 import { Subscriber } from '../Subscriber';
4 export function distinctUntilChanged(compare, keySelector) {
5 return function (source) { return source.lift(new DistinctUntilChangedOperator(compare, keySelector)); };
7 var DistinctUntilChangedOperator = /*@__PURE__*/ (function () {
8 function DistinctUntilChangedOperator(compare, keySelector) {
9 this.compare = compare;
10 this.keySelector = keySelector;
12 DistinctUntilChangedOperator.prototype.call = function (subscriber, source) {
13 return source.subscribe(new DistinctUntilChangedSubscriber(subscriber, this.compare, this.keySelector));
15 return DistinctUntilChangedOperator;
17 var DistinctUntilChangedSubscriber = /*@__PURE__*/ (function (_super) {
18 tslib_1.__extends(DistinctUntilChangedSubscriber, _super);
19 function DistinctUntilChangedSubscriber(destination, compare, keySelector) {
20 var _this = _super.call(this, destination) || this;
21 _this.keySelector = keySelector;
23 if (typeof compare === 'function') {
24 _this.compare = compare;
28 DistinctUntilChangedSubscriber.prototype.compare = function (x, y) {
31 DistinctUntilChangedSubscriber.prototype._next = function (value) {
34 var keySelector = this.keySelector;
35 key = keySelector ? keySelector(value) : value;
38 return this.destination.error(err);
43 var compare = this.compare;
44 result = compare(this.key, key);
47 return this.destination.error(err);
55 this.destination.next(value);
58 return DistinctUntilChangedSubscriber;
60 //# sourceMappingURL=distinctUntilChanged.js.map