ramda-adjunct
Version:
Ramda Adjunct is the most popular and most comprehensive set of utilities for use with Ramda, providing a variety of useful, well tested functions with excellent documentation.
36 lines (31 loc) • 1.11 kB
JavaScript
exports.__esModule = true;
exports["default"] = void 0;
var _ramda = require("ramda");
var _paths = _interopRequireDefault(require("./paths"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Merge objects under corresponding paths.
*
* @func mergePaths
* @memberOf RA
* @since {@link https://char0n.github.io/ramda-adjunct/1.17.0|v1.17.0}
* @category Object
* @sig [[k]] -> {k: {a}} -> {a}
* @see {@link RA.mergeProps|mergeProps}
* @param {!Array} paths The property paths to merge
* @param {!Object} obj The object to query
* @return {!Object} The object composed of merged property paths of obj
* @example
*
* const obj = {
* foo: { fooInner: { fooInner2: 1 } },
* bar: { barInner: 2 }
* };
*
* { ...obj.foo.fooInner, ...obj.bar }; //=> { fooInner2: 1, barInner: 2 }
* RA.mergePaths([['foo', 'fooInner'], ['bar']], obj); //=> { fooInner2: 1, barInner: 2 }
*/
var mergePaths = (0, _ramda.curryN)(2, (0, _ramda.pipe)(_paths["default"], _ramda.mergeAll));
var _default = mergePaths;
exports["default"] = _default;
;