import { ArgumentOutOfRangeException } from "../../shared" ; import { IParallelEnumerable , ParallelGeneratorType } from "../../types" ; import { BasicParallelEnumerable } from "../BasicParallelEnumerable" ; param start param count throws returns export const rangeParallel = ( start , count ) : IParallelEnumerable < number > => { if ( start < 0 || ( start + count - 1 ) > Number . MAX_SAFE_INTEGER ) { throw new ArgumentOutOfRangeException ( `start` ) ; } const generator = ( ) => { const items = [ ] ; const maxI = start + count ; for ( let i = start ; i < maxI ; i ++ ) { items . push ( Promise . resolve ( i ) ) ; } return items ; } ; return new BasicParallelEnumerable ( { generator , type : ParallelGeneratorType . ArrayOfPromises , } ) ; } ;