mergeDeep()

Returns a copy of the collection with the remaining collections merged in deeply (recursively).

mergeDeep<C>(
collection: C,
...collections: Array<Iterable<unknown> | Iterable<[unknown, unknown]> | {[key: string]: unknown}>
): C

Discussion

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

const { mergeDeep } = require('immutable') const original = { x: { y: 123 }} mergeDeep(original, { x: { z: 456 }}) // { x: { y: 123, z: 456 }} console.log(original) // { x: { y: 123 }}run it
This documentation is generated from immutable.d.ts. Pull requests and Issues welcome.