source: node_modules/ramda-adjunct/lib/mergeProp.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
Line 
1"use strict";
2
3exports.__esModule = true;
4exports["default"] = void 0;
5var _ramda = require("ramda");
6var _mergePath = _interopRequireDefault(require("./mergePath"));
7function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
8/**
9 * Create a new object with the own properties of the object under the `p`
10 * merged with the own properties of the provided `source`.
11 * If a key exists in both objects, the value from the `source` object will be used.
12 *
13 * @func mergeProp
14 * @memberOf RA
15 * @since {@link https://char0n.github.io/ramda-adjunct/1.18.0|v1.18.0}
16 * @category Object
17 * @sig [k] -> {a} -> {k: {a}} -> {k: {a}}
18 * @see {@link RA.mergePath|mergePath}
19 * @param {!Array} p The property of the destination object
20 * @param {!Object} source The source object
21 * @param {!Object} obj The object that has destination object under corresponding property
22 * @return {!Object} The new version of object
23 * @example
24 *
25 * RA.mergeProp(
26 * 'outer',
27 * { foo: 3, bar: 4 },
28 * { outer: { foo: 2 } }
29 * ); //=> { outer: { foo: 3, bar: 4 } };
30 */
31var mergeProp = (0, _ramda.curry)(function (p, subj, obj) {
32 return (0, _mergePath["default"])((0, _ramda.of)(Array, p), subj, obj);
33});
34var _default = mergeProp;
35exports["default"] = _default;
Note: See TracBrowser for help on using the repository browser.