TehShrike / deepmerge

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

Add arrayMergeStrategies #182

Closed hofnarwillie closed 4 years ago

hofnarwillie commented 4 years ago

Add arrayMergeStrategies named export for easy reference of the functions described in the readme. This allows the user to easily reference the most common functions used in the arrayMerge config option by using merge.arrayMergeStrategies.combineMerge

TehShrike commented 4 years ago

I'd rather not ship different possible strategies with this package – besides the larger codebase, I don't want the extra code to maintain.

I'd rather expand the readme to show people how to easily set up their customized deepmerge function for use in their app, e.g. https://github.com/TehShrike/deepmerge/issues/111#issuecomment-395134828 (with maybe a dash of https://twitter.com/Rich_Harris/status/1139908960520220677 ).

hofnarwillie commented 4 years ago

You could avoid increasing the final package size by moving the exports to a different file because most bundlers do a little treeshaking by default so the unused functions will not be included in the package. It means that every implementation of your code don't have to write unit tests for it.

Your call though.