Created
June 30, 2018 03:58
-
-
Save samzhao/463c9322d672b536633d247f34b91b8b to your computer and use it in GitHub Desktop.
Delayed map helper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const delayedMap = async (list, iterator, delayTime) => { | |
let promises = []; | |
for (const item of list) { | |
await delay(delayTime); | |
promises.push(await iterator(item)); | |
} | |
return Promise.all(promises); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment