how should data summarized by time be converted to summary at regular intervals?
let array = [{
date: "2018-11-01",
count: 10
},{
date: "2018-11-02",
count: 10
},{
date: "2018-11-03",
count: 20
},{
date: "2018-11-04",
count: 20
},
...];
=>
let array = [{
date: "2018-11-01~2018-11-02",
count: 20
},{
date: "2018-11-03~2018-11-04",
count: 40
},
...];
how can this array split be elegant enough?