Underscore.js: create a map out of list of objects using a key found in the object

For what it's worth, since underscore.js you can now use _.object()

var some_map = _.object(_.map(some_object_array, function(item) {
   return [item.id, item]
}));

for your case, you should use the indexBy function:

var some_object_array = [{id: "a", val: 55}, {id: "b", val: 1}, {id: "c", val: 45}];

var some_grouped_map = _.indexBy(some_object_array, 'id');

There is also this method

_.reduce(data, function (o, item) { o[item.key] = item.value; return o }, {})

Which is one statement with two statements in the inner function.