source: trip-planner-front/node_modules/rxjs/_esm5/internal/operators/pairwise.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
2import * as tslib_1 from "tslib";
3import { Subscriber } from '../Subscriber';
4export function pairwise() {
5 return function (source) { return source.lift(new PairwiseOperator()); };
6}
7var PairwiseOperator = /*@__PURE__*/ (function () {
8 function PairwiseOperator() {
9 }
10 PairwiseOperator.prototype.call = function (subscriber, source) {
11 return source.subscribe(new PairwiseSubscriber(subscriber));
12 };
13 return PairwiseOperator;
14}());
15var PairwiseSubscriber = /*@__PURE__*/ (function (_super) {
16 tslib_1.__extends(PairwiseSubscriber, _super);
17 function PairwiseSubscriber(destination) {
18 var _this = _super.call(this, destination) || this;
19 _this.hasPrev = false;
20 return _this;
21 }
22 PairwiseSubscriber.prototype._next = function (value) {
23 var pair;
24 if (this.hasPrev) {
25 pair = [this.prev, value];
26 }
27 else {
28 this.hasPrev = true;
29 }
30 this.prev = value;
31 if (pair) {
32 this.destination.next(pair);
33 }
34 };
35 return PairwiseSubscriber;
36}(Subscriber));
37//# sourceMappingURL=pairwise.js.map
Note: See TracBrowser for help on using the repository browser.