UNPKG

954 BJavaScriptView Raw
1import _objectAssign from "./internal/_objectAssign.js";
2import _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
28var merge =
29/*#__PURE__*/
30_curry2(function merge(l, r) {
31 return _objectAssign({}, l, r);
32});
33
34export default merge;
\No newline at end of file