Skip to content

Instantly share code, notes, and snippets.

@kylewelsby
Created November 21, 2015 19:00
Show Gist options
  • Save kylewelsby/1f973ea92c745dddc7c4 to your computer and use it in GitHub Desktop.
Save kylewelsby/1f973ea92c745dddc7c4 to your computer and use it in GitHub Desktop.
function promiseHash (hash) {
var promises = []
Object.keys(hash).map(function (key, index) {
return promises[index] = hash[key]
})
return Promise.all(promises).then(function (resolved) {
var response = {}
Object.keys(hash).map(function (key, index) {
response[key] = resolved[index]
})
return response
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment