swc/crates/swc_bundler/tests/.cache/deno/e023404be98d7776261688a96d643ca521f7bd68.ts
2021-11-09 20:42:49 +09:00

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;