Skip to content

Instantly share code, notes, and snippets.

@tjjfvi
Last active January 9, 2019 23:23
Show Gist options
  • Save tjjfvi/c1427e2ee24bc75a48c31ae31075222d to your computer and use it in GitHub Desktop.
Save tjjfvi/c1427e2ee24bc75a48c31ae31075222d to your computer and use it in GitHub Desktop.
Promise.allObjectValues(obj): Creates a Promise that awaits & returns al values of obj
Promise.allObjectValues = async obj =>
Object.assign({}, ...(await Promise.all(Object.entries(obj).map(async ([k, v]) => ({ [k]: await v })))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment