My current object structure is:
{
[
{ id: "AL01",
list: [
{ speed : 5
value : 10} ,
{ speed : 7
value : 15}
]
},
{ id: "AB01",
list: [
{ speed : 20
value : 1} ,
{ speed : 8
value : 10}
]
}
]
}
I aim to transform it into the following format:
{[ { id: "AL01", speed: 12, value: 25}, { id: "AB01", speed: 28, value: 11}]}
What is the most efficient way to achieve this? Is it possible to use the map or forEach functions only once? I am looking for a solution that processes each object only once.