Skip to content

Instantly share code, notes, and snippets.

@Janoyan
Created April 5, 2020 12:51
Show Gist options
  • Save Janoyan/21a737d02eba69e289850ae646b6c36f to your computer and use it in GitHub Desktop.
Save Janoyan/21a737d02eba69e289850ae646b6c36f to your computer and use it in GitHub Desktop.
const bluebird = require('bluebird');
async function task(data, ms = 500) {
console.log(data);
await bluebird.delay(ms);
return data;
}
bluebird.each(['A', 'B', 'C', 'D', 'E', 'F'], async (item) => {
return task(item);
}).then((result) => {
console.log(result);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment