This is the array of objects the I want to convert and get the total amount and clicks
[
{
date: "2020-05",
amount: 1000,
clicks: 15
}, {
date: "2020-05",
amount: 500,
clicks: 10
}, {
date: "2020-06",
amount: 2000,
clicks: 20
}
]
I want the array of objects above to be like this (with total amount and clicks)
{
amount: [
{
date: "2020-05",
value: 1500
}, {
date: "2020-06",
value: 2000
}
],
clicks: [
{
date: "2020-05",
value: 25
},
{
date: "2020-06",
value: 20
}
]
}