how to turn below array of object
const items = [
{ id: 1, name: 'a' },
{ id: 2, name: 'b' },
{ id: 3, name: 'c' },
{ id: 1, name: 'd' },
{ id: 3, name: 'f' },
{ id: 1, name: 'a' },
{ id: 3, name: 'c' },
];
into
const result = [
{ id: 1, names: ['a', 'd']},
{ id: 2, names: ['b']},
{ id: 3, names: ['c', 'f']}
]
without using external like lodash?