import { IAsyncEqualityComparer , IParallelEnumerable , ParallelGeneratorType } from "../../types" ; import { nextIterationAsync } from "./_nextIterationAsync" ; param source param value param comparer returns export const containsAsync = async < TSource > ( source , value , comparer ) : Promise < boolean > => { const values = nextIterationAsync ( source , ( x ) => comparer ( value , x ) ) ; switch ( values . type ) { case ParallelGeneratorType . ArrayOfPromises : { const data = await Promise . all ( values . generator ( ) ) ; return data . some ( ( x ) => x ) ; } case ParallelGeneratorType . PromiseOfPromises : { const data = await Promise . all ( await values . generator ( ) ) ; return data . some ( ( x ) => x ) ; } } } ;