source: node_modules/ramda/es/props.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: 928 bytes
Line 
1import _curry2 from "./internal/_curry2.js";
2import path from "./path.js";
3/**
4 * Acts as multiple `prop`: array of keys in, array of values out. Preserves
5 * order.
6 *
7 * @func
8 * @memberOf R
9 * @since v0.1.0
10 * @category Object
11 * @sig [k] -> {k: v} -> [v]
12 * @param {Array} ps The property names to fetch
13 * @param {Object} obj The object to query
14 * @return {Array} The corresponding values or partially applied function.
15 * @see R.prop, R.pluck, R.project
16 * @example
17 *
18 * R.props(['x', 'y'], {x: 1, y: 2}); //=> [1, 2]
19 * R.props(['c', 'a', 'b'], {b: 2, a: 1}); //=> [undefined, 1, 2]
20 *
21 * const fullName = R.compose(R.join(' '), R.props(['first', 'last']));
22 * fullName({last: 'Bullet-Tooth', age: 33, first: 'Tony'}); //=> 'Tony Bullet-Tooth'
23 */
24
25var props =
26/*#__PURE__*/
27_curry2(function props(ps, obj) {
28 return ps.map(function (p) {
29 return path([p], obj);
30 });
31});
32
33export default props;
Note: See TracBrowser for help on using the repository browser.