Executes an asynchronous function a specified number of times sequentially.
Executes the function with indices from 0 to count-1 incrementally. Each
execution is performed sequentially, and all results are collected into an
array.
Example
// Generate random data 5 times constrandomData = awaitArrayUtil.asyncRepeat(5)(async (index) => { awaitnewPromise(resolve=>setTimeout(resolve, 100)); // Wait 0.1 seconds return { id:index, value:Math.random(), timestamp:newDate().toISOString() }; }); console.log('Generated data:', randomData);
Executes an asynchronous function a specified number of times sequentially.
Executes the function with indices from 0 to count-1 incrementally. Each execution is performed sequentially, and all results are collected into an array.
Example