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
|
Rev | Line | |
---|
[d24f17c] | 1 | var _map =
|
---|
| 2 | /*#__PURE__*/
|
---|
| 3 | require("./internal/_map.js");
|
---|
| 4 |
|
---|
| 5 | var identity =
|
---|
| 6 | /*#__PURE__*/
|
---|
| 7 | require("./identity.js");
|
---|
| 8 |
|
---|
| 9 | var pickAll =
|
---|
| 10 | /*#__PURE__*/
|
---|
| 11 | require("./pickAll.js");
|
---|
| 12 |
|
---|
| 13 | var useWith =
|
---|
| 14 | /*#__PURE__*/
|
---|
| 15 | require("./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 |
|
---|
| 38 | var project =
|
---|
| 39 | /*#__PURE__*/
|
---|
| 40 | useWith(_map, [pickAll, identity]); // passing `identity` gives correct arity
|
---|
| 41 |
|
---|
| 42 | module.exports = project; |
---|
Note:
See
TracBrowser
for help on using the repository browser.