The map
function in underscore.js, if called with a javascript object, returns an array of values mapped from the object\'s values.
_.map({one:
I know this is old, but now Underscore has a new map for objects :
_.mapObject(object, iteratee, [context])
You can of course build a flexible map for both arrays and objects
_.fmap = function(arrayOrObject, fn, context){
if(this.isArray(arrayOrObject))
return _.map(arrayOrObject, fn, context);
else
return _.mapObject(arrayOrObject, fn, context);
}