UNPKG

rxjs

Version:

Reactive Extensions for modern JavaScript

15 lines 486 B
import { operate } from '../util/lift'; import { OperatorSubscriber } from './OperatorSubscriber'; export function pairwise() { return operate((source, subscriber) => { let prev; let hasPrev = false; source.subscribe(new OperatorSubscriber(subscriber, (value) => { const p = prev; prev = value; hasPrev && subscriber.next([p, value]); hasPrev = true; })); }); } //# sourceMappingURL=pairwise.js.map