Skip to content

Instantly share code, notes, and snippets.

@jjgonecrypto
Created November 28, 2019 05:57
Show Gist options
  • Save jjgonecrypto/ff1a432025133f4c9cd62a0ddd48e61b to your computer and use it in GitHub Desktop.
Save jjgonecrypto/ff1a432025133f4c9cd62a0ddd48e61b to your computer and use it in GitHub Desktop.
async forEach
// Useful if you want to run a bunch of promises in serial (which admittedly isn't very often frankly)
exports.asyncForEach = async (array, callback) => {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment