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