Skip to content

mergeWith

Merge two objects recursively, allowing for custom merge logic through a callback function.

Usage

ts
import { mergeWith } from 'rattail'

mergeWith({ a: [1, 2] }, { a: [3, 4] }, (objValue, srcValue) => [...objValue, ...srcValue])
// return: { a: [ 1, 2, 3, 4 ] }

Arguments

ArgTypeDefaults
objectobject
...sourcesobject[]
fn(objValue: any, srcValue: any, key: any, object: object, source: object) => any

Return

Type
object