npm.io
1.0.1 • Published 5 years ago

@alexsergey/async-loop

Licence
ISC
Version
1.0.1
Deps
1
Size
12 kB
Vulns
0
Weekly
0

Async Loop

Async loop and inverse async loop

import { asyncLoop, inverseAsyncLoop } from '@alexsergey/async-loop';

asyncLoop(items, (item, loop) => {
    //.. async logic
    loop.iteration() // return index of array iteration
    loop.next() // next iteration
    loop.break() // cancel loop
}, () => {
    // it calls after all iterations
})

Keywords