ix
Version:
The Interactive Extensions for JavaScript
66 lines (64 loc) • 2.77 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.concatAll = exports.ConcatAllAsyncIterable = void 0;
const tslib_1 = require("tslib");
const asynciterablex_js_1 = require("../asynciterablex.js");
const withabort_js_1 = require("./withabort.js");
const aborterror_js_1 = require("../../aborterror.js");
/** @ignore */
class ConcatAllAsyncIterable extends asynciterablex_js_1.AsyncIterableX {
constructor(source) {
super();
this._source = source;
}
[Symbol.asyncIterator](signal) {
return tslib_1.__asyncGenerator(this, arguments, function* _a() {
var _b, e_1, _c, _d, _e, e_2, _f, _g;
(0, aborterror_js_1.throwIfAborted)(signal);
try {
for (var _h = true, _j = tslib_1.__asyncValues((0, withabort_js_1.wrapWithAbort)(this._source, signal)), _k; _k = yield tslib_1.__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, tslib_1.__asyncValues((0, withabort_js_1.wrapWithAbort)(outer, signal))), _o; _o = yield tslib_1.__await(_m.next()), _e = _o.done, !_e; _l = true) {
_g = _o.value;
_l = false;
const item = _g;
yield yield tslib_1.__await(item);
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (!_l && !_e && (_f = _m.return)) yield tslib_1.__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 tslib_1.__await(_c.call(_j));
}
finally { if (e_1) throw e_1.error; }
}
});
}
}
exports.ConcatAllAsyncIterable = ConcatAllAsyncIterable;
/**
* 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.
*/
function concatAll() {
return function concatAllOperatorFunction(source) {
return new ConcatAllAsyncIterable(source);
};
}
exports.concatAll = concatAll;
//# sourceMappingURL=concatall.js.map