UNPKG

1.13 kBJavaScriptView Raw
1var _curry2 =
2/*#__PURE__*/
3require("./internal/_curry2");
4
5var mergeDeepWithKey =
6/*#__PURE__*/
7require("./mergeDeepWithKey");
8/**
9 * Creates a new object with the own properties of the first object merged with
10 * the own properties of the second object. If a key exists in both objects:
11 * - and both values are objects, the two values will be recursively merged
12 * - otherwise the value from the second object will be used.
13 *
14 * @func
15 * @memberOf R
16 * @since v0.24.0
17 * @category Object
18 * @sig {a} -> {a} -> {a}
19 * @param {Object} lObj
20 * @param {Object} rObj
21 * @return {Object}
22 * @see R.merge, R.mergeDeepLeft, R.mergeDeepWith, R.mergeDeepWithKey
23 * @example
24 *
25 * R.mergeDeepRight({ name: 'fred', age: 10, contact: { email: 'moo@example.com' }},
26 * { age: 40, contact: { email: 'baa@example.com' }});
27 * //=> { name: 'fred', age: 40, contact: { email: 'baa@example.com' }}
28 */
29
30
31var mergeDeepRight =
32/*#__PURE__*/
33_curry2(function mergeDeepRight(lObj, rObj) {
34 return mergeDeepWithKey(function (k, lVal, rVal) {
35 return rVal;
36 }, lObj, rObj);
37});
38
39module.exports = mergeDeepRight;
\No newline at end of file