Here is an example of my array structure:
[
{
"detail": "item1",
"status": "active",
"data": "item1_data"
},
{
"detail": "item2",
"status": "inactive",
"data": "item2_data"
},
{
"detail": "item3",
"status": "active",
"data": "item3_data"
},
{
"detail": "item4",
"status": "inactive",
"data": "item4_data"
}
]
My goal is to transform the above array into this format:
{
item1: item1_data,
item2: item2_data,
item3: item3_data,
item4: item4_data
}
With a large number of objects in the source array and multiple arrays to work on, I am looking for the most efficient method using typescript. What approach would be best?