TehShrike / deepmerge

A library for deep (recursive) merging of Javascript objects
MIT License
2.75k stars 216 forks source link

Possible to remove duplicate objects in arrays? #251

Closed basickarl closed 2 years ago

basickarl commented 2 years ago

As the title stated is it possible to remove duplicate array objects when deep merging? I am referring to identical objects with identical values.

I tried the arrayMerge but that really isn't what I'm looking for, I'd like any array no matter how nested to figure this out automatically.

TehShrike commented 2 years ago

You can pass in a custom arrayMerge function that combines the arrays in the source and target however you like. https://github.com/TehShrike/deepmerge#arraymerge