function deepMerge
deepMerge<T extends Record<PropertyKey, unknown>>(): TMerges the two given Records, recursively merging any nested Records with the second collection overriding the first in case of conflict
For arrays, maps and sets, a merging strategy can be specified to either
replace values, or merge them instead. Use includeNonEnumerable option
to include non-enumerable properties too.
Examples
Example 1
Example 1
import { deepMerge } from "@std/collections/deep_merge"; import { assertEquals } from "@std/assert/assert_equals"; const a = { foo: true }; const b = { foo: { bar: true } }; assertEquals(deepMerge(a, b), { foo: { bar: true } });
Type Parameters
T extends Record<PropertyKey, unknown>Parameters
Return Type
deepMerge<T extends Record<PropertyKey, unknown>,U extends Record<PropertyKey, unknown>,Options extends DeepMergeOptions>(record: Readonly<T>,other: Readonly<U>,options?: Readonly<Options>): DeepMerge<T, U, Options>Merges the two given Records, recursively merging any nested Records with the second collection overriding the first in case of conflict
For arrays, maps and sets, a merging strategy can be specified to either
replace values, or merge them instead. Use includeNonEnumerable option
to include non-enumerable properties too.
Examples
Example 1
Example 1
import { deepMerge } from "@std/collections/deep_merge"; import { assertEquals } from "@std/assert/assert_equals"; const a = { foo: true }; const b = { foo: { bar: true } }; assertEquals(deepMerge(a, b), { foo: { bar: true } });
Type Parameters
T extends Record<PropertyKey, unknown>U extends Record<PropertyKey, unknown>Options extends DeepMergeOptions