source: node_modules/ramda/src/project.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: 1.0 KB
Line 
1var _map =
2/*#__PURE__*/
3require("./internal/_map.js");
4
5var identity =
6/*#__PURE__*/
7require("./identity.js");
8
9var pickAll =
10/*#__PURE__*/
11require("./pickAll.js");
12
13var useWith =
14/*#__PURE__*/
15require("./useWith.js");
16/**
17 * Reasonable analog to SQL `select` statement.
18 *
19 * @func
20 * @memberOf R
21 * @since v0.1.0
22 * @category Object
23 * @category Relation
24 * @sig [k] -> [{k: v}] -> [{k: v}]
25 * @param {Array} props The property names to project
26 * @param {Array} objs The objects to query
27 * @return {Array} An array of objects with just the `props` properties.
28 * @see R.pluck, R.props, R.prop
29 * @example
30 *
31 * const abby = {name: 'Abby', age: 7, hair: 'blond', grade: 2};
32 * const fred = {name: 'Fred', age: 12, hair: 'brown', grade: 7};
33 * const kids = [abby, fred];
34 * R.project(['name', 'grade'], kids); //=> [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}]
35 */
36
37
38var project =
39/*#__PURE__*/
40useWith(_map, [pickAll, identity]); // passing `identity` gives correct arity
41
42module.exports = project;
Note: See TracBrowser for help on using the repository browser.