import { IAsyncEqualityComparer , IAsyncParallel , IParallelEnumerable , ParallelGeneratorType } from "../../types" ; import { BasicParallelEnumerable } from "../BasicParallelEnumerable" ; param source param comparer returns export const distinctAsync = < TSource > ( source , comparer ) : IParallelEnumerable < TSource > => { const generator = async ( ) => { const distinctElements = [ ] ; outerLoop : for ( const item of await source . toArray ( ) ) { for ( const distinctElement of distinctElements ) { const found = await comparer ( distinctElement , item ) ; if ( found ) { continue outerLoop ; } } distinctElements . push ( item ) ; } return distinctElements ; } ; return new BasicParallelEnumerable ( { generator , type : ParallelGeneratorType . PromiseToArray , } ) ; } ;