選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

32 行
1.1 KiB

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