问题
I'm using the bluebird library to do asynchronous calls in javascript. I noticed there's a map function so I can apply a asynchronous function to each element in an array. However, I want to use this method on a object that has keys. Is there a way to do this?
回答1:
There are many way to convert an object to array like this :
Object.keys(yourObject).map(function(key){ return yourObject[key] })
You can use Promise.map too
来源:https://stackoverflow.com/questions/32193946/bluebird-map-on-hashmap-obj