pairwise.js 494 B

123456789101112131415
  1. import { operate } from '../util/lift';
  2. import { createOperatorSubscriber } from './OperatorSubscriber';
  3. export function pairwise() {
  4. return operate((source, subscriber) => {
  5. let prev;
  6. let hasPrev = false;
  7. source.subscribe(createOperatorSubscriber(subscriber, (value) => {
  8. const p = prev;
  9. prev = value;
  10. hasPrev && subscriber.next([p, value]);
  11. hasPrev = true;
  12. }));
  13. });
  14. }
  15. //# sourceMappingURL=pairwise.js.map