Skip to content

Instantly share code, notes, and snippets.

@Ivannnnn
Created April 27, 2020 17:05
Show Gist options
  • Save Ivannnnn/fe40068984bdf701d124523f32188a27 to your computer and use it in GitHub Desktop.
Save Ivannnnn/fe40068984bdf701d124523f32188a27 to your computer and use it in GitHub Desktop.
async function asyncForEach(array, callback) {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
const asyncMap = async (arr, cb) =>
Promise.all(arr.map(async (a, i) => await cb(a, i)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment