-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
Description
I would like to have a async.map method working on objects like the async.forEachOf does. As a working wrapper I currently use (as coffeescript):
forMapOf = (obj, iterator, cb) ->
# check the object
return cb new Error "mapOf only works on objects" unless typeof obj is 'object'
# map over object keys
keys = Object.keys obj
async.map keys, (key, cb) ->
# call iterator with value and key
iterator obj[key], key, cb
, (err, results) ->
return cb err if err
# combine the results into an object again
map = {}
for num in [0..keys.length-1]
map[keys[num]] = results[num]
cb null, mapIs it possible to integrate such functionality directly with it's limit and series partners?