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.
33 lines (30 loc) • 981 B
JavaScript
exports.__esModule = true;
exports["default"] = void 0;
var _ramda = require("ramda");
/**
* Acts as multiple path: arrays of paths in, array of values out. Preserves order.
*
* @func paths
* @memberOf RA
* @since {@link https://char0n.github.io/ramda-adjunct/1.2.0|v1.2.0}
* @category List
* @sig [[k]] -> {k: v} - [v]
* @param {Array} ps The property paths to fetch
* @param {Object} obj The object to query
* @return {Array} The corresponding values or partially applied function
* @see {@link https://github.com/ramda/ramda/wiki/Cookbook#derivative-of-rprops-for-deep-fields|Ramda Cookbook}, {@link http://ramdajs.com/docs/#props|R.props}
* @example
*
* const obj = {
* a: { b: { c: 1 } },
* x: 2,
* };
*
* RA.paths([['a', 'b', 'c'], ['x']], obj); //=> [1, 2]
*/
var paths = (0, _ramda.curry)(function (ps, obj) {
return (0, _ramda.ap)([(0, _ramda.path)(_ramda.__, obj)], ps);
});
var _default = paths;
exports["default"] = _default;
;