UNPKG

parallel-es

Version:
24 lines (23 loc) 1.34 kB
import { IParallelGenerator } from "./parallel-generator"; import { FunctionCallSerializer } from "../../function/function-call-serializer"; import { ISerializedFunctionCall } from "../../function/serialized-function-call"; import { FunctionCall } from "../../function/function-call"; import { IParallelTaskEnvironment } from "../"; /** * Generic generator that calls a passed in function n times to create n values */ export declare class ParallelTimesGenerator implements IParallelGenerator { static create<TResult>(n: number, generator: (this: void, index: number, env: IParallelTaskEnvironment) => TResult): ParallelTimesGenerator; static create<T>(n: number, value: T): ParallelTimesGenerator; static create(n: number, call: FunctionCall): ParallelTimesGenerator; readonly times: number; readonly iteratee: FunctionCall; /** * Creates a new times generator that repeats the value generated by the iteratee n times. * @param n the number of times the value should be repeated * @param iteratee function that is called n times and generates the value or a constant value that is repeated */ private constructor(n, iteratee); readonly length: number; serializeSlice(index: number, numberOfItems: number, functionCallSerializer: FunctionCallSerializer): ISerializedFunctionCall; }