param source param index returns export const elementAtOrDefault = async < TSource > ( source , index ) : Promise < TSource | null > => { let i = 0 ; for await ( const item of source ) { if ( index === i ++ ) { return item ; } } return null ; } ;