mergeDeep()

Like merge(), but when two compatible collections are encountered with the same key, it merges them as well, recursing deeply through the nested data. Two collections are considered to be compatible (and thus will be merged together) if they both fall into one of three categories: keyed (e.g., Maps, Records, and objects), indexed (e.g., Lists and arrays), or set-like (e.g., Sets). If they fall into separate categories, mergeDeep will replace the existing collection with the collection being merged in. This behavior can be customized by using mergeDeepWith().

Method signature

mergeDeep(collection, ...collections)

Note: Indexed and set-like collections are merged using concat()/union() and therefore do not recurse.

A functional alternative to collection.mergeDeep() which will also work with plain Objects and Arrays.

;