import { IParallelEnumerable , ParallelGeneratorType , TypedData } from "../types" ; private export class BasicParallelEnumerable < TSource > { public readonly dataFunc : TypedData < TSource > ; public constructor ( dataFunc ) { this . dataFunc = dataFunc ; } public [ Symbol . asyncIterator ] ( ) { const { dataFunc } = this ; async function * iterator ( ) { switch ( dataFunc . type ) { case ParallelGeneratorType . ArrayOfPromises : for ( const value of dataFunc . generator ( ) ) { yield value ; } break ; case ParallelGeneratorType . PromiseOfPromises : for ( const value of await dataFunc . generator ( ) ) { yield value ; } break ; case ParallelGeneratorType . PromiseToArray : default : for ( const value of await dataFunc . generator ( ) ) { yield value ; } break ; } } return iterator ( ) ; } } private export interface BasicParallelEnumerable < TSource > extends IParallelEnumerable < TSource > { }