Skip to content

Instantly share code, notes, and snippets.

@Deepak13245
Created June 2, 2020 19:17
Show Gist options
  • Save Deepak13245/e49c1853ebceacbd3ab6f725c42b4ba6 to your computer and use it in GitHub Desktop.
Save Deepak13245/e49c1853ebceacbd3ab6f725c42b4ba6 to your computer and use it in GitHub Desktop.
Running async functions in parallel
function inParallel(list, fn) {
return Promise.all(
list.map(async (...args) => {
try{
return {
status: true,
result: await fn(...args),
};
}catch(error){
return {
status: false,
result: error,
};
}
})
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment