// 元データ
[
{ name: 'taro', age: 10 },
{ name: 'jiro', age: 20, email: 'jiro@example.com' },
{ name: 'saburo', age: 30, email: 'saburo@example.com' }
]
// 欲しいデータ(ユーザごとではなくそれぞれのフィールドでグルーピングしたい)
{
name: ['taro', 'jiro', 'saburo'],
age: [10, 20, 30],
email: ['jiro@example.com', 'saburo@example.com']
}
このようにデータを変換するため、lodash(underscore.js)、ES2015(ES6)、ES5のそれぞれの実装方法をまとめる。





