@reactivex/ix-esnext-esm
Version:
The Interactive Extensions for JavaScript
28 lines (26 loc) • 795 B
JavaScript
import { AsyncIterableX } from '../asynciterablex';
export class SkipWhileAsyncIterable extends AsyncIterableX {
constructor(source, predicate) {
super();
this._source = source;
this._predicate = predicate;
}
async *[Symbol.asyncIterator]() {
let yielding = false;
let i = 0;
for await (const element of this._source) {
if (!yielding && !(await this._predicate(element, i++))) {
yielding = true;
}
if (yielding) {
yield element;
}
}
}
}
export function skipWhile(predicate) {
return function skipWhileOperatorFunction(source) {
return new SkipWhileAsyncIterable(source, predicate);
};
}
//# sourceMappingURL=skipwhile.mjs.map