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