ix
Version:
The Interactive Extensions for JavaScript
50 lines (48 loc) • 2.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.onErrorResumeNext = exports.OnErrorResumeNextAsyncIterable = 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 OnErrorResumeNextAsyncIterable extends asynciterablex_js_1.AsyncIterableX {
constructor(source) {
super();
this._source = source;
}
[Symbol.asyncIterator](signal) {
return tslib_1.__asyncGenerator(this, arguments, function* _a() {
(0, aborterror_js_1.throwIfAborted)(signal);
for (const item of this._source) {
const it = (0, withabort_js_1.wrapWithAbort)(item, signal)[Symbol.asyncIterator]();
while (1) {
let next;
try {
next = yield tslib_1.__await(it.next());
}
catch (e) {
break;
}
if (next.done) {
break;
}
yield yield tslib_1.__await(next.value);
}
}
});
}
}
exports.OnErrorResumeNextAsyncIterable = OnErrorResumeNextAsyncIterable;
/**
* Concatenates all of the specified async-iterable sequences, even if the previous async-iterable sequence terminated exceptionally.
*
* @template T The type of the elements in the source sequences.
* @param {...AsyncIterable<T>[]} args Async-iterable sequences to concatenate.
* @returns {AsyncIterableX<T>} An async-iterable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.
*/
function onErrorResumeNext(...args) {
return new OnErrorResumeNextAsyncIterable(args);
}
exports.onErrorResumeNext = onErrorResumeNext;
//# sourceMappingURL=onerrorresumenext.js.map