@reactivex/ix-esnext-esm
Version:
The Interactive Extensions for JavaScript
26 lines (24 loc) • 707 B
JavaScript
import { AsyncIterableX } from '../asynciterablex';
export class TakeUntilAsyncIterable extends AsyncIterableX {
constructor(source, other) {
super();
this._source = source;
this._other = other;
}
async *[Symbol.asyncIterator]() {
let otherDone = false;
this._other().then(() => (otherDone = true));
for await (const item of this._source) {
if (otherDone) {
break;
}
yield item;
}
}
}
export function takeUntil(other) {
return function takeUntilOperatorFunction(source) {
return new TakeUntilAsyncIterable(source, other);
};
}
//# sourceMappingURL=takeuntil.mjs.map