mirror of
https://github.com/swc-project/swc.git
synced 2024-12-22 13:11:31 +03:00
35 lines
982 B
TypeScript
35 lines
982 B
TypeScript
|
// Loaded from https://deno.land/x/ramda@v0.27.2/source/props.js
|
||
|
|
||
|
|
||
|
import _curry2 from './internal/_curry2.js';
|
||
|
import path from './path.js';
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Acts as multiple `prop`: array of keys in, array of values out. Preserves
|
||
|
* order.
|
||
|
*
|
||
|
* @func
|
||
|
* @memberOf R
|
||
|
* @since v0.1.0
|
||
|
* @category Object
|
||
|
* @sig [k] -> {k: v} -> [v]
|
||
|
* @param {Array} ps The property names to fetch
|
||
|
* @param {Object} obj The object to query
|
||
|
* @return {Array} The corresponding values or partially applied function.
|
||
|
* @see R.prop, R.pluck, R.project
|
||
|
* @example
|
||
|
*
|
||
|
* R.props(['x', 'y'], {x: 1, y: 2}); //=> [1, 2]
|
||
|
* R.props(['c', 'a', 'b'], {b: 2, a: 1}); //=> [undefined, 1, 2]
|
||
|
*
|
||
|
* const fullName = R.compose(R.join(' '), R.props(['first', 'last']));
|
||
|
* fullName({last: 'Bullet-Tooth', age: 33, first: 'Tony'}); //=> 'Tony Bullet-Tooth'
|
||
|
*/
|
||
|
var props = _curry2(function props(ps, obj) {
|
||
|
return ps.map(function(p) {
|
||
|
return path([p], obj);
|
||
|
});
|
||
|
});
|
||
|
export default props;
|