source: node_modules/ramda/es/mergeDeepWith.js

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: 1.2 KB
RevLine 
[d24f17c]1import _curry3 from "./internal/_curry3.js";
2import mergeDeepWithKey from "./mergeDeepWithKey.js";
3/**
4 * Creates a new object with the own properties of the two provided objects.
5 * If a key exists in both objects:
6 * - and both associated values are also objects then the values will be
7 * recursively merged.
8 * - otherwise the provided function is applied to associated values using the
9 * resulting value as the new value associated with the key.
10 * If a key only exists in one object, the value will be associated with the key
11 * of the resulting object.
12 *
13 * @func
14 * @memberOf R
15 * @since v0.24.0
16 * @category Object
17 * @sig ((a, a) -> a) -> {a} -> {a} -> {a}
18 * @param {Function} fn
19 * @param {Object} lObj
20 * @param {Object} rObj
21 * @return {Object}
22 * @see R.mergeWith, R.mergeDeepWithKey
23 * @example
24 *
25 * R.mergeDeepWith(R.concat,
26 * { a: true, c: { values: [10, 20] }},
27 * { b: true, c: { values: [15, 35] }});
28 * //=> { a: true, b: true, c: { values: [10, 20, 15, 35] }}
29 */
30
31var mergeDeepWith =
32/*#__PURE__*/
33_curry3(function mergeDeepWith(fn, lObj, rObj) {
34 return mergeDeepWithKey(function (k, lVal, rVal) {
35 return fn(lVal, rVal);
36 }, lObj, rObj);
37});
38
39export default mergeDeepWith;
Note: See TracBrowser for help on using the repository browser.