I did this function:
const obj = [{id: 'a', time: 1}, {id: 'a', time: 2}, {id: 'b', time: 1}];
const objMapped = obj.reduce((acc, item) => {
let { id, time } = item;
acc[id] = acc[id] || [];
acc[id].push(time);
return acc;
}, {});...
asked by
20.09.2016 / 16:24