This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/rxjs/_esm2015/internal/operators/pairwise.js

29 lines
723 B
JavaScript
Raw Normal View History

2019-08-11 18:48:02 +00:00
import { Subscriber } from '../Subscriber';
export function pairwise() {
return (source) => source.lift(new PairwiseOperator());
}
class PairwiseOperator {
call(subscriber, source) {
return source.subscribe(new PairwiseSubscriber(subscriber));
}
}
class PairwiseSubscriber extends Subscriber {
constructor(destination) {
super(destination);
this.hasPrev = false;
}
_next(value) {
let pair;
if (this.hasPrev) {
pair = [this.prev, value];
}
else {
this.hasPrev = true;
}
this.prev = value;
if (pair) {
this.destination.next(pair);
}
}
}
//# sourceMappingURL=pairwise.js.map