var arr = [{ item_id: "2", add_id: "1", time_start: "13:00" },{ item_id: "2", add_id: "4", time_start: "13:00" },{ item_id: "2", add_id: "11", time_start: "15:00" },{ item_id: "3", add_id: "11", time_start: "15:00" }]
const obj = arr.reduce ((map, {item_id, add_id, time_start}) => {
const map_id = map[item_id] ?? (map[item_id] = {}, map[item_id]);
const map_start = map_id[time_start]?? (map_id[time_start] = [], map_id[time_start]);
map_start.push(add_id);
return map;
}, {});
const result = [];
for (const item_id in obj) {
for (const time_start in obj[item_id]) {
result.push({item_id, add_id:obj[item_id][time_start], time_start});
}
}
console.log(result);