@reactivex/ix-esnext-esm
Version:
The Interactive Extensions for JavaScript
28 lines (26 loc) • 700 B
JavaScript
import { AsyncIterableX } from '../asynciterablex';
export class PairwiseAsyncIterable extends AsyncIterableX {
constructor(source) {
super();
this._source = source;
}
async *[Symbol.asyncIterator]() {
let value;
let hasValue = false;
for await (const item of this._source) {
if (!hasValue) {
hasValue = true;
}
else {
yield [value, item];
}
value = item;
}
}
}
export function pairwise() {
return function pairwiseOperatorFunction(source) {
return new PairwiseAsyncIterable(source);
};
}
//# sourceMappingURL=pairwise.mjs.map