It would be quite useful to be able to take certain action (such as debug logging) when deepmerging objects that causes properties to collide with one another.
Collision found for prop foo -> value: otherFoo takes precedence over value: foo. Path to prop: foo
Collision found for prop hello -> value: planet takes precedence over value: world. Path to prop: qux.hello
callback API is just a first idea for what meta data is useful to pass to a collision function.
I haven't really thought through how this would work fo: functions & other non-plain objects, but for Arrays I suppose it doesn't make that much sense, because they always collide and need to be merged in some way e.g. by concating them. So perhaps a better name is onPropCollision if it only makes sense for object properties.
I'm willing to create a PR for this, just let me know (maintainer(s))
It would be quite useful to be able to take certain action (such as debug logging) when deepmerging objects that causes properties to collide with one another.
Example:
Console output:
callback API is just a first idea for what meta data is useful to pass to a collision function.
I haven't really thought through how this would work fo: functions & other non-plain objects, but for Arrays I suppose it doesn't make that much sense, because they always collide and need to be merged in some way e.g. by concating them. So perhaps a better name is
onPropCollision
if it only makes sense for object properties.I'm willing to create a PR for this, just let me know (maintainer(s))