UNPKG

815 BJavaScriptView Raw
1var _curry3 =
2/*#__PURE__*/
3require("./internal/_curry3");
4
5var path =
6/*#__PURE__*/
7require("./path");
8/**
9 * Returns `true` if the specified object property at given path satisfies the
10 * given predicate; `false` otherwise.
11 *
12 * @func
13 * @memberOf R
14 * @since v0.19.0
15 * @category Logic
16 * @typedefn Idx = String | Int
17 * @sig (a -> Boolean) -> [Idx] -> {a} -> Boolean
18 * @param {Function} pred
19 * @param {Array} propPath
20 * @param {*} obj
21 * @return {Boolean}
22 * @see R.propSatisfies, R.path
23 * @example
24 *
25 * R.pathSatisfies(y => y > 0, ['x', 'y'], {x: {y: 2}}); //=> true
26 * R.pathSatisfies(R.is(Object), [], {x: {y: 2}}); //=> true
27 */
28
29
30var pathSatisfies =
31/*#__PURE__*/
32_curry3(function pathSatisfies(pred, propPath, obj) {
33 return pred(path(propPath, obj));
34});
35
36module.exports = pathSatisfies;
\No newline at end of file