selfrefactor/rambda

mergeDeepRight first parameter does not work with objects containing functions

mauriciosoares opened this issue · 2 comments

When using mergeDeepRight, if I pass an object in the first parameter that contains a property that is a funcion, that function is not merged into the final object. Having a function in the second parameter works just fine though, for example:

R.mergeDeepRight({a: () => {}}, {b: () => {}})

This will produce an object with only b as a property containing the function.

Here's a codesandbox example with a few other scenarios: https://codesandbox.io/s/js-playground-forked-okrk5x?file=/src/index.js, that code sample also contains an example of Ramda's mergeDeepRight

Yes, it is a valid issue and thank you for opening it. It is caused by using JSON.parse(JSON.stringify to clone an object. The fix was to use the slower method R.clone. Fix will be released with version 7.3.0

done with 7.3.0