Share your code. Components are building blocks, you are the architect.

utils/merge-deep-with-key
v1.1.0
1.1.0
MIT
PUBLIC
3
Build: fail
BuildFail
Build Status: fail
Creates a new object with the own properties of the two provided objects

Please configure Bit as a scoped registry to install components with NPM.Learn more

npm config set '@bit:registry' https://node.bitsrc.io
Use utils/merge-deep-with-key in your project
npm i @bit/bit.ramda.utils.merge-deep-with-key
Copied

mergeDeepWithKey (fn:Function, lObj:Object, rObj:Object) : Object

Creates a new object with the own properties of the two provided objects. If a key exists in both objects:

  • and both associated values are also objects then the values will be recursively merged.
  • otherwise the provided function is applied to the key and associated values using the resulting value as the new value associated with the key. If a key only exists in one object, the value will be associated with the key of the resulting object.

Example

let concatValues = (k, l, r) => k == 'values' ? R.concat(l, r) : r
     R.mergeDeepWithKey(concatValues,
                        { a: true, c: { thing: 'foo', values: [10, 20] }},
                        { b: true, c: { thing: 'bar', values: [15, 35] }});
     //=> { a: true, b: true, c: { thing: 'bar', values: [10, 20, 15, 35] }}

Arguments

fn: Function

lObj: Object

rObj: Object

Returns

Object