I want to remove duplicates in an array of objects, depending on object attributes.
Simplified example: Assuming you have an array like:
[
 { 
   name: 'alice',
   something: 123
 },
 {
   name: 'alice',
   something: 321
 },
 {
  name: 'bob',
  something: 213
 }
]
I want to remove objects, wich have the same value for name, but I want to decide which object to remove with some custom calculation (e.g. keep the object with bigger value for something).
I was able to adapt the accepted answer in find duplicate values in a JavaScript array, but that does not work so well with more than 2 duplicates.
 
     
     
    