The data looks like this:
const data = [
{'a': '1', 'b': '2', 'c': '3'},
{'a': '10', 'b': '20', 'c': '30'}
]
I want this:
const aArray = ['1','10']
,bArray = ['2', '20']
,cArray = ['3', '30']
I did this:
...
return {
aArray = _.values(_.mapValues(data, 'a'))
bArray = _.values(_.mapValues(data, 'b'))
cArray = _.values(_.mapValues(data, 'c'))
}
It works but doesn't look clean. What's the cleanest way to group an object by multiple keys?