UNPKG

@reactivex/ix-esnext-esm

Version:

The Interactive Extensions for JavaScript

28 lines (26 loc) 658 B
import { IterableX } from '../iterablex'; export class PairwiseIterable extends IterableX { constructor(source) { super(); this._source = source; } *[Symbol.iterator]() { let value; let hasValue = false; for (const item of this._source) { if (!hasValue) { hasValue = true; } else { yield [value, item]; } value = item; } } } export function pairwise() { return function pairwiseOperatorFunction(source) { return new PairwiseIterable(source); }; } //# sourceMappingURL=pairwise.mjs.map