UNPKG

984 BJavaScriptView Raw
1var _map =
2/*#__PURE__*/
3require("./internal/_map");
4
5var identity =
6/*#__PURE__*/
7require("./identity");
8
9var pickAll =
10/*#__PURE__*/
11require("./pickAll");
12
13var useWith =
14/*#__PURE__*/
15require("./useWith");
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 * @example
29 *
30 * const abby = {name: 'Abby', age: 7, hair: 'blond', grade: 2};
31 * const fred = {name: 'Fred', age: 12, hair: 'brown', grade: 7};
32 * const kids = [abby, fred];
33 * R.project(['name', 'grade'], kids); //=> [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}]
34 */
35
36
37var project =
38/*#__PURE__*/
39useWith(_map, [pickAll, identity]); // passing `identity` gives correct arity
40
41module.exports = project;
\No newline at end of file