main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
955 bytes
|
Rev | Line | |
---|
[d24f17c] | 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.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.mergeLeft, R.mergeDeepRight, R.mergeWith, R.mergeWithKey
|
---|
| 17 | * @example
|
---|
| 18 | *
|
---|
| 19 | * R.mergeRight({ 'name': 'fred', 'age': 10 }, { 'age': 40 });
|
---|
| 20 | * //=> { 'name': 'fred', 'age': 40 }
|
---|
| 21 | *
|
---|
| 22 | * const withDefaults = R.mergeRight({x: 0, y: 0});
|
---|
| 23 | * withDefaults({y: 2}); //=> {x: 0, y: 2}
|
---|
| 24 | * @symb R.mergeRight(a, b) = {...a, ...b}
|
---|
| 25 | */
|
---|
| 26 |
|
---|
| 27 | var mergeRight =
|
---|
| 28 | /*#__PURE__*/
|
---|
| 29 | _curry2(function mergeRight(l, r) {
|
---|
| 30 | return _objectAssign({}, l, r);
|
---|
| 31 | });
|
---|
| 32 |
|
---|
| 33 | export default mergeRight; |
---|
Note:
See
TracBrowser
for help on using the repository browser.