merge es-toolkit
Deeply merges the source object into the target object, modifying the target object.
Usage
merge(target, source)
Use merge when you want to deeply merge two objects. Nested objects and arrays are also merged recursively. Unlike toMerged, this function modifies the original target object.
undefined values do not overwrite existing values.
Parameters
The target object to merge the source object into. This object is modified.
The source object to merge into the target object.
Returns
(Merge<T, S>): Returns the target object with the source object merged in. Nested object types are merged property by property.
Examples
Try It
::: sandpack
:::
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.