I have a data structure like
const dd = [{
keyone: "test",
two: "you",
three: 'op',
}, {
keyone: "youuuu",
two: "ttt",
three: 'op',
}, {
keyone: "operation",
two: "test",
three: 'op',
}];
And I am wanting to be able to pull out keyone and two into an object like the following
const obj = { keyone: ['test', 'youuuu', 'operation'], two: ['you', 'ttt', 'test']}
I've achieved this using two maps and combining them but I would like to use only one loop if possible.
EDIT:
I am currently using destructuring to extract values:
const mapOne = dd.map(({ keyone }) => keyone);
const mapTwo = dd.map(({ two }) => two);
const test = {
keyone: mapOne,
two: mapTwo,
};