co-gather
Execute thunks, generators, async functions in parallel with concurrency support and gather all the results.
co-gather
is similar with co-parallel, but co-gather
will gather all the result of these thunks, even those thunks throw error.
Installation
$ npm install co-gather
Example
const gather = ;const sleep = ; { ; if error throw error; return result;} { await ; if error throw error; return result;} console;;
=>
[
{ isError: false, value: 1 },
{ isError: true, error: [Error: error] },
{ isError: true, error: [Error: error] },
{ isError: false, value: 4 }
]
API
gather(items, [concurrency])
Execute items
in parallel, with the given concurrency defaulting to 5, and gather the result
License
MIT