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.
32 lines (29 loc) • 939 B
JavaScript
exports.__esModule = true;
exports["default"] = void 0;
var _ramda = require("ramda");
/**
* Functional equivalent of merging object properties with object spread operator.
*
* @func mergeProps
* @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.mergePaths|mergePaths}
* @param {!Array} ps The property names to merge
* @param {!Object} obj The object to query
* @return {!Object} The object composed of merged properties of obj
* @example
*
* const obj = {
* foo: { fooInner: 1 },
* bar: { barInner: 2 }
* };
*
* { ...obj.foo, ...obj.bar }; //=> { fooInner: 1, barInner: 2 }
* RA.mergeProps(['foo', 'bar'], obj); //=> { fooInner: 1, barInner: 2 }
*/
var mergeProps = (0, _ramda.curryN)(2, (0, _ramda.pipe)(_ramda.props, _ramda.mergeAll));
var _default = mergeProps;
exports["default"] = _default;
;