async-looper
Fast, flexible and simple function that loops through each array or object element to execute asynchronous code.
Usage
This function expect four parameters:
- Element to loop through
- Function to execute each time
- Function to execute when loop finish.
- Number of times needed to execute
nextTick
const loop = let counter = 0let array = 1 2 3 4 5
It can loop over objects.
const loop = let object = a: 1 b: 2 c: 3 d: 4let newValueToA = 100;
If you need you can stop the loop just passing a second param to the next function.
const loop = const END_LOOP = loopEND_LOOP const limit = 5let counter = 0let array = 1 2 3 4 5 6
The finish callback has an array of errors or it's null
const loop = let array = 1 2 3 4 5 6
TODO
- Improve the documentation.
- Benchmarks.
- Should we have the key value while loop through an array?