Estoy buscando una función simple en js (si es posible en la versión Es6) para recuperar todos los duplicados de una matriz de objetos en el valor del email solo, por ejemplo:
const array = [ {id: 1, email: 'test1@exemple.fr', nom: 'nom'}, {id: 2, email: 'test2@exemple.fr', nom: 'nom'}, {id: 3, email: 'test3@exemple.fr', nom: 'nom'}, {id: 4, email: 'test@exemple.fr', nom: 'nom'}, {id: 5, email: 'test4@exemple.fr', nom: 'nom'}, {id: 6, email: 'test5@exemple.fr', nom: 'nom'}, {id: 7, email: 'test6@exemple.fr', nom: 'nom'}, {id: 8, email: 'test@exemple.fr', nom: 'nom'}, {id: 9, email: 'test@exemple.fr', nom: 'nom'}, {id: 10, email: 'test@exemple.fr', nom: 'nom'}, {id: 11, email: 'test2@exemple.fr', nom: 'nom'}, {id: 12, email: 'test2@exemple.fr', nom: 'nom'}, ]Y el resultado que quiero obtener es este:
return = [ {id: 8, email: 'test@exemple.fr', nom: 'nom'}, {id: 9, email: 'test@exemple.fr', nom: 'nom'}, {id: 10, email: 'test@exemple.fr', nom: 'nom'}, { id: 11, email: 'test2@exemple.fr', nom: 'nom'}, {id: 12, email: 'test2@exemple.fr', nom: 'nom'} ]Gracias por tu ayuda :)