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