I have a js object array as below
[
[
{file: 'file1',
status: 'pending',
time: '2021-08-13 11:20:00'
},
{file: 'file2',
status: 'pending',
time: '2021-08-13 11:20:00'
}
],
[
{file: 'file1',
status: 'completed',
time: '2021-08-13 09:30:00'
},
{file: 'file2',
status: 'completed',
time: '2021-08-13 09:30:00'
}
],
[
{file: 'file3',
status: 'completed',
time: '2021-08-14 06:50:00'
}
]
]
And i need to filter the array based on the file field and remove the duplicated sub arrays. So the output should look like
[
[
{file: 'file1',
status: 'pending',
time: '2021-08-13 11:20:00'
},
{file: 'file2',
status: 'pending',
time: '2021-08-13 11:20:00'
}
],
[
{file: 'file3',
status: 'completed',
time: '2021-08-14 06:50:00'
}
]
]
What is the easiest way to do this. Can we use ES6 here?