import { StrictEqualityComparer } from "../../shared" ; import { IAsyncParallel , IEqualityComparer , IParallelEnumerable , ParallelGeneratorType } from "../../types" ; import { BasicParallelEnumerable } from "../BasicParallelEnumerable" ; param outer param inner param outerKeySelector param innerKeySelector param resultSelector param comparer returns export const join = < TOuter , TInner , TKey , TResult > ( outer , inner , outerKeySelector , innerKeySelector , resultSelector , comparer = StrictEqualityComparer ) : IParallelEnumerable < TResult > => { const generator = async ( ) => { const [ innerArray , outerArray ] = await Promise . all ( [ inner . toArray ( ) , outer . toArray ( ) ] ) ; const results = new Array < TResult > ( ) ; for ( const o of outerArray ) { const outerKey = outerKeySelector ( o ) ; for ( const i of innerArray ) { const innerKey = innerKeySelector ( i ) ; if ( comparer ( outerKey , innerKey ) === true ) { results . push ( resultSelector ( o , i ) ) ; } } } return results ; } ; return new BasicParallelEnumerable ( { generator , type : ParallelGeneratorType . PromiseToArray , } ) ; } ;