You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
954 B

4 years ago
  1. import _objectAssign from "./internal/_objectAssign.js";
  2. import _curry2 from "./internal/_curry2.js";
  3. /**
  4. * Create 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. * the value from the second object will be used.
  7. *
  8. * @func
  9. * @memberOf R
  10. * @since v0.1.0
  11. * @category Object
  12. * @sig {k: v} -> {k: v} -> {k: v}
  13. * @param {Object} l
  14. * @param {Object} r
  15. * @return {Object}
  16. * @see R.mergeRight, R.mergeDeepRight, R.mergeWith, R.mergeWithKey
  17. * @deprecated since v0.26.0
  18. * @example
  19. *
  20. * R.merge({ 'name': 'fred', 'age': 10 }, { 'age': 40 });
  21. * //=> { 'name': 'fred', 'age': 40 }
  22. *
  23. * const withDefaults = R.merge({x: 0, y: 0});
  24. * withDefaults({y: 2}); //=> {x: 0, y: 2}
  25. * @symb R.merge(a, b) = {...a, ...b}
  26. */
  27. var merge =
  28. /*#__PURE__*/
  29. _curry2(function merge(l, r) {
  30. return _objectAssign({}, l, r);
  31. });
  32. export default merge;