-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
questionFurther information is requestedFurther information is requested
Description
As others have pointed out, we already have [...new Set(array)]
for primitives. So, I think that the question this proposal is addressing can be generalized to, "use something other than ===
to find duplicate objects in a Set".
Here are a couple other potential ways to solve this problem off the top of my head (I haven't thought them through; these are just ideas):
[...new Set(array, { comparator: (a, b) => a.id === b.id })]
-- this would set a comparator on the Set to be used for all future additions to that specific Set.Object.prototype[@@setKey]
-- if present on an object,[@@setKey]
should be used instead of the object pointer when checking for equality in the Set.
bergus, axetroy and RudxainRudxainTechQuery and Rudxain
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested