Created
June 28, 2018 09:40
-
-
Save d0mmie/190061873ee85cbb3da460bd3ce7011a to your computer and use it in GitHub Desktop.
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
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