UNPKG

1.06 kBJavaScriptView Raw
1var _curry3 =
2/*#__PURE__*/
3require("./internal/_curry3");
4
5var mergeWithKey =
6/*#__PURE__*/
7require("./mergeWithKey");
8/**
9 * Creates a new object with the own properties of the two provided objects. If
10 * a key exists in both objects, the provided function is applied to the values
11 * associated with the key in each object, with the result being used as the
12 * value associated with the key in the returned object.
13 *
14 * @func
15 * @memberOf R
16 * @since v0.19.0
17 * @category Object
18 * @sig ((a, a) -> a) -> {a} -> {a} -> {a}
19 * @param {Function} fn
20 * @param {Object} l
21 * @param {Object} r
22 * @return {Object}
23 * @see R.mergeDeepWith, R.merge, R.mergeWithKey
24 * @example
25 *
26 * R.mergeWith(R.concat,
27 * { a: true, values: [10, 20] },
28 * { b: true, values: [15, 35] });
29 * //=> { a: true, b: true, values: [10, 20, 15, 35] }
30 */
31
32
33var mergeWith =
34/*#__PURE__*/
35_curry3(function mergeWith(fn, l, r) {
36 return mergeWithKey(function (_, _l, _r) {
37 return fn(_l, _r);
38 }, l, r);
39});
40
41module.exports = mergeWith;
\No newline at end of file