blob: bbf02c16b441dc764d8838184155446087fffc09 [file] [log] [blame]
var _curry2 = /*#__PURE__*/require('./internal/_curry2');
var path = /*#__PURE__*/require('./path');
/**
* Returns a function that when supplied an object returns the indicated
* property of that object, if it exists.
*
* @func
* @memberOf R
* @since v0.1.0
* @category Object
* @sig s -> {s: a} -> a | Undefined
* @param {String} p The property name
* @param {Object} obj The object to query
* @return {*} The value at `obj.p`.
* @see R.path
* @example
*
* R.prop('x', {x: 100}); //=> 100
* R.prop('x', {}); //=> undefined
* R.compose(R.inc, R.prop('x'))({ x: 3 }) //=> 4
*/
var prop = /*#__PURE__*/_curry2(function prop(p, obj) {
return path([p], obj);
});
module.exports = prop;