@reactivex/ix-esnext-esm
Version:
The Interactive Extensions for JavaScript
29 lines (27 loc) • 786 B
JavaScript
import { AsyncIterableX } from '../asynciterablex';
export class SkipAsyncIterable extends AsyncIterableX {
constructor(source, count) {
super();
this._source = source;
this._count = count;
}
async *[Symbol.asyncIterator]() {
const it = this._source[Symbol.asyncIterator]();
let count = this._count;
let next;
while (count > 0 && !(next = await it.next()).done) {
count--;
}
if (count <= 0) {
while (!(next = await it.next()).done) {
yield next.value;
}
}
}
}
export function skip(count) {
return function skipOperatorFunction(source) {
return new SkipAsyncIterable(source, count);
};
}
//# sourceMappingURL=skip.mjs.map