source: node_modules/ramda/es/pathSatisfies.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: 792 bytes
Line 
1import _curry3 from "./internal/_curry3.js";
2import path from "./path.js";
3/**
4 * Returns `true` if the specified object property at given path satisfies the
5 * given predicate; `false` otherwise.
6 *
7 * @func
8 * @memberOf R
9 * @since v0.19.0
10 * @category Logic
11 * @typedefn Idx = String | Int | Symbol
12 * @sig (a -> Boolean) -> [Idx] -> {a} -> Boolean
13 * @param {Function} pred
14 * @param {Array} propPath
15 * @param {*} obj
16 * @return {Boolean}
17 * @see R.propSatisfies, R.path
18 * @example
19 *
20 * R.pathSatisfies(y => y > 0, ['x', 'y'], {x: {y: 2}}); //=> true
21 * R.pathSatisfies(R.is(Object), [], {x: {y: 2}}); //=> true
22 */
23
24var pathSatisfies =
25/*#__PURE__*/
26_curry3(function pathSatisfies(pred, propPath, obj) {
27 return pred(path(propPath, obj));
28});
29
30export default pathSatisfies;
Note: See TracBrowser for help on using the repository browser.