source: node_modules/ramda/src/pathEq.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.2 KB
Line 
1var _curry3 =
2/*#__PURE__*/
3require("./internal/_curry3.js");
4
5var equals =
6/*#__PURE__*/
7require("./equals.js");
8
9var path =
10/*#__PURE__*/
11require("./path.js");
12/**
13 * Determines whether a nested path on an object has a specific value, in
14 * [`R.equals`](#equals) terms. Most likely used to filter a list.
15 *
16 * @func
17 * @memberOf R
18 * @since v0.7.0
19 * @category Relation
20 * @typedefn Idx = String | Int | Symbol
21 * @sig a -> [Idx] -> {a} -> Boolean
22 * @param {*} val The value to compare the nested property with
23 * @param {Array} path The path of the nested property to use
24 * @param {Object} obj The object to check the nested property in
25 * @return {Boolean} `true` if the value equals the nested object property,
26 * `false` otherwise.
27 * @see R.whereEq, R.propEq, R.pathSatisfies, R.equals
28 * @example
29 *
30 * const user1 = { address: { zipCode: 90210 } };
31 * const user2 = { address: { zipCode: 55555 } };
32 * const user3 = { name: 'Bob' };
33 * const users = [ user1, user2, user3 ];
34 * const isFamous = R.pathEq(90210, ['address', 'zipCode']);
35 * R.filter(isFamous, users); //=> [ user1 ]
36 */
37
38
39var pathEq =
40/*#__PURE__*/
41_curry3(function pathEq(val, _path, obj) {
42 return equals(path(_path, obj), val);
43});
44
45module.exports = pathEq;
Note: See TracBrowser for help on using the repository browser.