mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-11 10:01:06 +03:30
25 lines
650 B
JavaScript
Vendored
25 lines
650 B
JavaScript
Vendored
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) {
|
|
if (this.hasPrev) {
|
|
this.destination.next([this.prev, value]);
|
|
}
|
|
else {
|
|
this.hasPrev = true;
|
|
}
|
|
this.prev = value;
|
|
}
|
|
}
|
|
//# sourceMappingURL=pairwise.js.map
|