UNPKG

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