I have an array of objects and I have duplicated value on it and I want to merge all duration who have been created in the same date and who have the same file Name
Thank You In Advance :)
I have array of objects
[
{
fileName: "test.js"
duration: 1500,
createt_at: "2019-07-26T09:57:28.126Z"
},
{
fileName: "test.js"
duration: 1500,
createt_at: "2019-07-26T10:00:28.126Z"
},
{
fileName: "test.js"
duration: 1500,
createt_at: "2019-07-26T09:57:28.126Z"
},
{
fileName: "main.js"
duration: 1500,
createt_at: "2019-07-26T09:57:28.126Z"
},
{
fileName: "main.js"
duration: 3000,
createt_at: "2019-07-28T10:57:28.126Z"
},
{
fileName: "main.js"
duration: 2000,
createt_at: "2019-07-28T11:00:28.126Z"
}
{
fileName: "main.js"
duration: 100,
createt_at: "2019-07-28T09:00:28.126Z"
}
]
Output Array Of Objects Need To Be Like This :
[
{
fileName: "test.js"
duration: 3000,
createt_at: "2019-07-26"
},
{
fileName: "main.js"
duration: 1500,
createt_at: "2019-07-26"
},
{
fileName: "main.js"
duration: 5100,
createt_at: "2019-07-28"
}
]