1 | import { AsyncIterableX } from './asynciterablex';
|
2 | import { wrapWithAbort } from './operators/withabort';
|
3 | import { throwIfAborted } from '../aborterror';
|
4 | export class OnErrorResumeNextAsyncIterable extends AsyncIterableX {
|
5 | constructor(source) {
|
6 | super();
|
7 | this._source = source;
|
8 | }
|
9 | async *[Symbol.asyncIterator](signal) {
|
10 | throwIfAborted(signal);
|
11 | for (const item of this._source) {
|
12 | const it = wrapWithAbort(item, signal)[Symbol.asyncIterator]();
|
13 | while (1) {
|
14 | let next;
|
15 | try {
|
16 | next = await it.next();
|
17 | }
|
18 | catch (e) {
|
19 | break;
|
20 | }
|
21 | if (next.done) {
|
22 | break;
|
23 | }
|
24 | yield next.value;
|
25 | }
|
26 | }
|
27 | }
|
28 | }
|
29 | /**
|
30 | * Concatenates all of the specified async-iterable sequences, even if the previous async-iterable sequence terminated exceptionally.
|
31 | *
|
32 | * @export
|
33 | * @template T The type of the elements in the source sequences.
|
34 | * @param {...AsyncIterable<T>[]} args Async-iterable sequences to concatenate.
|
35 | * @returns {AsyncIterableX<T>} An async-iterable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.
|
36 | */
|
37 | export function onErrorResumeNext(...args) {
|
38 | return new OnErrorResumeNextAsyncIterable(args);
|
39 | }
|
40 |
|
41 | //# sourceMappingURL=onerrorresumenext.mjs.map
|