32 lines
893 B
JavaScript
32 lines
893 B
JavaScript
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.
|
|
* @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 =
|
|
/*#__PURE__*/
|
|
_curry2(function props(ps, obj) {
|
|
return ps.map(function (p) {
|
|
return path([p], obj);
|
|
});
|
|
});
|
|
|
|
export default props; |