UNPKG

1.11 kBJavaScriptView Raw
1var _curry3 =
2/*#__PURE__*/
3require("./internal/_curry3");
4
5var equals =
6/*#__PURE__*/
7require("./equals");
8/**
9 * Returns `true` if the specified object property is equal, in
10 * [`R.equals`](#equals) terms, to the given value; `false` otherwise.
11 * You can test multiple properties with [`R.whereEq`](#whereEq).
12 *
13 * @func
14 * @memberOf R
15 * @since v0.1.0
16 * @category Relation
17 * @sig String -> a -> Object -> Boolean
18 * @param {String} name
19 * @param {*} val
20 * @param {*} obj
21 * @return {Boolean}
22 * @see R.whereEq, R.propSatisfies, R.equals
23 * @example
24 *
25 * const abby = {name: 'Abby', age: 7, hair: 'blond'};
26 * const fred = {name: 'Fred', age: 12, hair: 'brown'};
27 * const rusty = {name: 'Rusty', age: 10, hair: 'brown'};
28 * const alois = {name: 'Alois', age: 15, disposition: 'surly'};
29 * const kids = [abby, fred, rusty, alois];
30 * const hasBrownHair = R.propEq('hair', 'brown');
31 * R.filter(hasBrownHair, kids); //=> [fred, rusty]
32 */
33
34
35var propEq =
36/*#__PURE__*/
37_curry3(function propEq(name, val, obj) {
38 return equals(val, obj[name]);
39});
40
41module.exports = propEq;
\No newline at end of file