import { fromAsync } from "../../async/static/fromAsync" ; import { IAsyncEnumerable , IAsyncEqualityComparer } from "../../types" ; param source param comparer returns export const distinctAsync = < TSource > ( source , comparer ) : IAsyncEnumerable < TSource > => { async function * iterator ( ) { const distinctElements = [ ] ; outerLoop : for ( const item of source ) { for ( const distinctElement of distinctElements ) { const found = await comparer ( distinctElement , item ) ; if ( found ) { continue outerLoop ; } } distinctElements . push ( item ) ; yield item ; } } return fromAsync ( iterator ) ; } ;