如果我从以下内容开始:
使用underscore.js或lodash,我想获取一个单一的哈希/对象,其中包含来自集合的所有值的数组:
有什么想法吗?
var people = [
{id: 9, name: 'Bob', age: 14},
{id: 11, name: 'Joe', age: 15},
{id: 12, name: 'Ash', age: 24}]
使用underscore.js或lodash,我想获取一个单一的哈希/对象,其中包含来自集合的所有值的数组:
{
id: [9, 11, 12],
name: ['Bob', 'Joe', 'Ash'],
age: [14, 15, 24]
}
有什么想法吗?