source: node_modules/ramda-adjunct/lib/paths.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: 979 bytes
Line 
1"use strict";
2
3exports.__esModule = true;
4exports["default"] = void 0;
5var _ramda = require("ramda");
6/**
7 * Acts as multiple path: arrays of paths in, array of values out. Preserves order.
8 *
9 * @func paths
10 * @memberOf RA
11 * @since {@link https://char0n.github.io/ramda-adjunct/1.2.0|v1.2.0}
12 * @category List
13 * @sig [[k]] -> {k: v} - [v]
14 * @param {Array} ps The property paths to fetch
15 * @param {Object} obj The object to query
16 * @return {Array} The corresponding values or partially applied function
17 * @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}
18 * @example
19 *
20 * const obj = {
21 * a: { b: { c: 1 } },
22 * x: 2,
23 * };
24 *
25 * RA.paths([['a', 'b', 'c'], ['x']], obj); //=> [1, 2]
26 */
27var paths = (0, _ramda.curry)(function (ps, obj) {
28 return (0, _ramda.ap)([(0, _ramda.path)(_ramda.__, obj)], ps);
29});
30var _default = paths;
31exports["default"] = _default;
Note: See TracBrowser for help on using the repository browser.