mirror of
https://github.com/swc-project/swc.git
synced 2024-12-20 20:22:26 +03:00
32 lines
1011 B
TypeScript
32 lines
1011 B
TypeScript
|
// Loaded from https://deno.land/x/ramda@v0.27.2/source/project.js
|
||
|
|
||
|
|
||
|
import _map from './internal/_map.js';
|
||
|
import identity from './identity.js';
|
||
|
import pickAll from './pickAll.js';
|
||
|
import useWith from './useWith.js';
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Reasonable analog to SQL `select` statement.
|
||
|
*
|
||
|
* @func
|
||
|
* @memberOf R
|
||
|
* @since v0.1.0
|
||
|
* @category Object
|
||
|
* @category Relation
|
||
|
* @sig [k] -> [{k: v}] -> [{k: v}]
|
||
|
* @param {Array} props The property names to project
|
||
|
* @param {Array} objs The objects to query
|
||
|
* @return {Array} An array of objects with just the `props` properties.
|
||
|
* @see R.pluck, R.props, R.prop
|
||
|
* @example
|
||
|
*
|
||
|
* const abby = {name: 'Abby', age: 7, hair: 'blond', grade: 2};
|
||
|
* const fred = {name: 'Fred', age: 12, hair: 'brown', grade: 7};
|
||
|
* const kids = [abby, fred];
|
||
|
* R.project(['name', 'grade'], kids); //=> [{name: 'Abby', grade: 2}, {name: 'Fred', grade: 7}]
|
||
|
*/
|
||
|
var project = useWith(_map, [pickAll, identity]); // passing `identity` gives correct arity
|
||
|
export default project;
|