@reactivex/ix-es2015-cjs
Version:
The Interactive Extensions for JavaScript
57 lines (55 loc) • 2.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.concat = exports._concatAll = exports.ConcatAsyncIterable = void 0;
const tslib_1 = require("tslib");
const asynciterablex_js_1 = require("./asynciterablex.js");
const withabort_js_1 = require("./operators/withabort.js");
const aborterror_js_1 = require("../aborterror.js");
/** @ignore */
class ConcatAsyncIterable 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;
(0, aborterror_js_1.throwIfAborted)(signal);
for (const outer of this._source) {
try {
for (var _e = true, _f = (e_1 = void 0, tslib_1.__asyncValues((0, withabort_js_1.wrapWithAbort)(outer, signal))), _g; _g = yield tslib_1.__await(_f.next()), _b = _g.done, !_b; _e = true) {
_d = _g.value;
_e = false;
const item = _d;
yield yield tslib_1.__await(item);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (!_e && !_b && (_c = _f.return)) yield tslib_1.__await(_c.call(_f));
}
finally { if (e_1) throw e_1.error; }
}
}
});
}
}
exports.ConcatAsyncIterable = ConcatAsyncIterable;
function _concatAll(source) {
return new ConcatAsyncIterable(source);
}
exports._concatAll = _concatAll;
/**
* Concatenates all async-iterable sequences in the given sequences, as long as the previous async-iterable
* sequence terminated successfully.
*
* @template T The type of the elements in the sequences.
* @param {...AsyncIterable<T>[]} args The async-iterable sources.
* @returns {AsyncIterableX<T>} An async-iterable sequence that contains the elements of each given sequence, in sequential order.
*/
function concat(...args) {
return new ConcatAsyncIterable(args);
}
exports.concat = concat;
//# sourceMappingURL=concat.js.map