frontend/.pnpm-store/v3/files/e9/2ba150a9265d5e5f7792156da9dd9b27dc52dc1406a19101f57319d4c963c6a82e2d9b412ddf1069ae42f9f2dab53cedfc23bdb179e134d2fd0a03e47caf51

29 lines
723 B
Plaintext

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