i have this data, and i want to mapping this data without using lodash
let temp = [{
"2020": 0,
"2021": 0,
"Series": "Check Qty Plunger Lub"
},
{
"2020": 1,
"2021": 4,
"Series": "Cleaning 5MK"
}
];
and i want to remapping the object like this
[
2020 : {
Series : 2020,
Check Qty Plunger Lub : 0,
Cleaning 5MK : 1,
},
2021 : {
Series : 2021,
Check Qty Plunger Lub : 0,
Cleaning 5MK : 4,
},
etc ..
]
the key is using year, and inside the year object is have dynamic keys using temp.series, and value is following the temp object
example : Check qty plunger lub have 0 value on 2020, and 0 on 2021 so the object must
2020 : {
Series : 2020,
Check Qty Plunger Lub : 0,
...
},