Skip to content

Instantly share code, notes, and snippets.

@d0mmie
Created June 28, 2018 09:40
Show Gist options
  • Save d0mmie/190061873ee85cbb3da460bd3ce7011a to your computer and use it in GitHub Desktop.
Save d0mmie/190061873ee85cbb3da460bd3ce7011a to your computer and use it in GitHub Desktop.
export default async (obj) => {
const promiseArray = await Promise.all(Object.values(obj))
return Object.keys(obj).map((key, index) => ({ key, index })).reduce((total, { key, index }) => ({ ...total, [key]: promiseArray[index] }), {})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment