import { AsyncIterableX } from './asynciterablex' ; import { throwIfAborted } from '../aborterror' ; class AnonymousAsyncIterable < T > extends AsyncIterableX < T > { private _fn : ( signal ? : AbortSignal ) => AsyncIterator < T > | Promise < AsyncIterator < T > > ; constructor ( fn ) { super ( ) ; this . _fn = fn ; } async * [ Symbol . asyncIterator ] ( signal ? ) { throwIfAborted ( signal ) ; const it = await this . _fn ( signal ) ; let next ; while ( ! ( next = await it . next ( ) ) . done ) { yield next . value ; } } } template T param { ( ( signal ? : AbortSignal ) => AsyncIterator < T > | Promise < AsyncIterator < T > > ) } fn returns { AsyncIterableX < T > } export function create < T > ( fn ) { return new AnonymousAsyncIterable ( fn ) ; }