Hello guys can you help me reduce arrays please. I have two arrays and I need group one of them by mid. Here you can find example
I have array of objects
const arr = [{
mid: 888,
name: "test"
},
{
mid: 888,
name: "test1"
},
{
mid: 888,
name: "test2"
},
{
mid: 777,
name: "test10"
},
]
But I need group by mid and get something like this
const arr = [{
mid: 888,
projects: [{
name: "test"
},
{
name: "test1"
},
{
name: "test2"
},
]
},
{
mid: 777,
projects: [{
name: "test10"
}, ]
}
]