source: node_modules/ramda/es/propEq.js

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.4 KB
Line 
1import _curry3 from "./internal/_curry3.js";
2import prop from "./prop.js";
3import equals from "./equals.js";
4/**
5 * Returns `true` if the specified object property is equal, in
6 * [`R.equals`](#equals) terms, to the given value; `false` otherwise.
7 * You can test multiple properties with [`R.whereEq`](#whereEq),
8 * and test nested path property with [`R.pathEq`](#pathEq).
9 *
10 * @func
11 * @memberOf R
12 * @since v0.1.0
13 * @category Relation
14 * @sig a -> String -> Object -> Boolean
15 * @param {*} val The value to compare the property with
16 * @param {String} name the specified object property's key
17 * @param {*} obj The object to check the property in
18 * @return {Boolean} `true` if the value equals the specified object property,
19 * `false` otherwise.
20 * @see R.whereEq, R.pathEq, R.propSatisfies, R.equals
21 * @example
22 *
23 * const abby = {name: 'Abby', age: 7, hair: 'blond'};
24 * const fred = {name: 'Fred', age: 12, hair: 'brown'};
25 * const rusty = {name: 'Rusty', age: 10, hair: 'brown'};
26 * const alois = {name: 'Alois', age: 15, disposition: 'surly'};
27 * const kids = [abby, fred, rusty, alois];
28 * const hasBrownHair = R.propEq('brown', 'hair');
29 * R.filter(hasBrownHair, kids); //=> [fred, rusty]
30 */
31
32var propEq =
33/*#__PURE__*/
34_curry3(function propEq(val, name, obj) {
35 return equals(val, prop(name, obj));
36});
37
38export default propEq;
Note: See TracBrowser for help on using the repository browser.