UNPKG

984 BJavaScriptView Raw
1var _objectAssign =
2/*#__PURE__*/
3require("./internal/_objectAssign");
4
5var _curry2 =
6/*#__PURE__*/
7require("./internal/_curry2");
8/**
9 * Create 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 * the value from the first object will be used.
12 *
13 * @func
14 * @memberOf R
15 * @since v0.26.0
16 * @category Object
17 * @sig {k: v} -> {k: v} -> {k: v}
18 * @param {Object} l
19 * @param {Object} r
20 * @return {Object}
21 * @see R.mergeRight, R.mergeDeepLeft, R.mergeWith, R.mergeWithKey
22 * @example
23 *
24 * R.mergeLeft({ 'age': 40 }, { 'name': 'fred', 'age': 10 });
25 * //=> { 'name': 'fred', 'age': 40 }
26 *
27 * const resetToDefault = R.mergeLeft({x: 0});
28 * resetToDefault({x: 5, y: 2}); //=> {x: 0, y: 2}
29 * @symb R.mergeLeft(a, b) = {...b, ...a}
30 */
31
32
33var mergeLeft =
34/*#__PURE__*/
35_curry2(function mergeLeft(l, r) {
36 return _objectAssign({}, r, l);
37});
38
39module.exports = mergeLeft;
\No newline at end of file