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.

32 line
952 B

4 年之前
  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 first object will be used.
  7. *
  8. * @func
  9. * @memberOf R
  10. * @since v0.26.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.mergeDeepLeft, R.mergeWith, R.mergeWithKey
  17. * @example
  18. *
  19. * R.mergeLeft({ 'age': 40 }, { 'name': 'fred', 'age': 10 });
  20. * //=> { 'name': 'fred', 'age': 40 }
  21. *
  22. * const resetToDefault = R.mergeLeft({x: 0});
  23. * resetToDefault({x: 5, y: 2}); //=> {x: 0, y: 2}
  24. * @symb R.mergeLeft(a, b) = {...b, ...a}
  25. */
  26. var mergeLeft =
  27. /*#__PURE__*/
  28. _curry2(function mergeLeft(l, r) {
  29. return _objectAssign({}, r, l);
  30. });
  31. export default mergeLeft;