1 | "use strict";
|
---|
2 |
|
---|
3 | exports.__esModule = true;
|
---|
4 | exports["default"] = void 0;
|
---|
5 | var _ramda = require("ramda");
|
---|
6 | var _mergePath = _interopRequireDefault(require("./mergePath"));
|
---|
7 | function _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 | */
|
---|
31 | var mergeProp = (0, _ramda.curry)(function (p, subj, obj) {
|
---|
32 | return (0, _mergePath["default"])((0, _ramda.of)(Array, p), subj, obj);
|
---|
33 | });
|
---|
34 | var _default = mergeProp;
|
---|
35 | exports["default"] = _default; |
---|