ix
Version:
The Interactive Extensions for JavaScript
61 lines (59 loc) • 2.44 kB
JavaScript
import { __asyncGenerator, __asyncValues, __await } from "tslib";
import { AsyncIterableX } from '../asynciterablex.mjs';
import { wrapWithAbort } from './withabort.mjs';
import { throwIfAborted } from '../../aborterror.mjs';
/** @ignore */
export class ConcatAllAsyncIterable extends AsyncIterableX {
constructor(source) {
super();
this._source = source;
}
[Symbol.asyncIterator](signal) {
return __asyncGenerator(this, arguments, function* _a() {
var _b, e_1, _c, _d, _e, e_2, _f, _g;
throwIfAborted(signal);
try {
for (var _h = true, _j = __asyncValues(wrapWithAbort(this._source, signal)), _k; _k = yield __await(_j.next()), _b = _k.done, !_b; _h = true) {
_d = _k.value;
_h = false;
const outer = _d;
try {
for (var _l = true, _m = (e_2 = void 0, __asyncValues(wrapWithAbort(outer, signal))), _o; _o = yield __await(_m.next()), _e = _o.done, !_e; _l = true) {
_g = _o.value;
_l = false;
const item = _g;
yield yield __await(item);
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (!_l && !_e && (_f = _m.return)) yield __await(_f.call(_m));
}
finally { if (e_2) throw e_2.error; }
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (!_h && !_b && (_c = _j.return)) yield __await(_c.call(_j));
}
finally { if (e_1) throw e_1.error; }
}
});
}
}
/**
* Concatenates all inner async-iterable sequences, as long as the previous
* async-iterable sequence terminated successfully.
*
* @template T The type of elements in the source sequence.
* @returns {OperatorAsyncFunction<AsyncIterable<T>, T>} An operator which concatenates all inner async-iterable sources.
*/
export function concatAll() {
return function concatAllOperatorFunction(source) {
return new ConcatAllAsyncIterable(source);
};
}
//# sourceMappingURL=concatall.mjs.map