import { AsyncIterableX } from './asynciterablex' ; import { wrapWithAbort } from './operators/withabort' ; import { throwIfAborted } from '../aborterror' ; export class OnErrorResumeNextAsyncIterable < TSource > extends AsyncIterableX < TSource > { private _source : Iterable < AsyncIterable < TSource > > ; constructor ( source ) { super ( ) ; this . _source = source ; } async * [ Symbol . asyncIterator ] ( signal ? ) { throwIfAborted ( signal ) ; for ( const item of this . _source ) { const it = wrapWithAbort ( item , signal ) [ Symbol . asyncIterator ] ( ) ; while ( 1 ) { let next ; try { next = await it . next ( ) ; } catch ( e ) { break ; } if ( next . done ) { break ; } yield next . value ; } } } } template T param { ... AsyncIterable < T > [ ] } args returns { AsyncIterableX < T > } export function onErrorResumeNext < T > ( ... args ) { return new OnErrorResumeNextAsyncIterable < T > ( args ) ; }