propEq.js•1.01 kB
var _curry3 = require('./internal/_curry3');
var equals = require('./equals');
var propSatisfies = require('./propSatisfies');
/**
* Returns `true` if the specified object property is equal, in `R.equals`
* terms, to the given value; `false` otherwise.
*
* @func
* @memberOf R
* @since v0.1.0
* @category Relation
* @sig String -> a -> Object -> Boolean
* @param {String} name
* @param {*} val
* @param {*} obj
* @return {Boolean}
* @see R.equals, R.propSatisfies
* @example
*
* var abby = {name: 'Abby', age: 7, hair: 'blond'};
* var fred = {name: 'Fred', age: 12, hair: 'brown'};
* var rusty = {name: 'Rusty', age: 10, hair: 'brown'};
* var alois = {name: 'Alois', age: 15, disposition: 'surly'};
* var kids = [abby, fred, rusty, alois];
* var hasBrownHair = R.propEq('hair', 'brown');
* R.filter(hasBrownHair, kids); //=> [fred, rusty]
*/
module.exports = _curry3(function propEq(name, val, obj) {
return propSatisfies(equals(val), name, obj);
});