Ramda.js R.pathSatisfies() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Logic

Definition

Ramda’s R.pathSatisfies() answers a nested validation question: does the value at this path pass my predicate? You pass a predicate, a path array, then the object. Ramda reads the nested leftover with R.path, then calls your predicate. You get true or false. Native code would manually index each segment. R.pathSatisfies is a function, arity 3, automatically curried, so R.pathSatisfies(R.gt(0), ['score']) is already a function of one object.

The official sample is the whole idea. R.pathSatisfies(y => y > 0, ['x', 'y'], {x: {y: 2}}) is true because 2 > 0. R.pathSatisfies(R.is(Object), [], {x: {y: 2}}) is true because an empty path tests the whole object. Need to read the value without a test? That is R.path. Need one top-level key? That is propSatisfies. Need strict equality? That is pathEq. Previous Logic helper is R.or. Next is R.propSatisfies.

Syntax

Call R.pathSatisfies. Start with this line.

Ramda
R.pathSatisfies(pred, path, obj)
CallWhat it does
R.pathSatisfies(pred, path, obj)Primary signature.
R.pathSatisfies(...)Call the logic helper.

Prefer import { pathSatisfies } from "ramda" when you want a named import.

Library declarations
Ramda
R.pathSatisfies(pred, path, obj)

Parameters

ParameterDescription
predRequired. Function. Predicate run on the nested leftover from R.path. Should return true or false.
pathRequired. Array of keys. Nested path such as ['x', 'y'] or ['items', 0]. An empty array tests the whole object.
objRequired. Object. The record to query. Missing segments make R.path return undefined.

Return Value

Return ValueDescription
Booleantrue when the predicate passes on the nested leftover. Otherwise false. The object is not mutated.

Ramda Examples

📚 Getting Started

The official Ramda predicate samples, then cousins propSatisfies, path, and pathEq.

Example 1 — Official Predicate Samples

The docs show a nested positive check and an empty-path object test. Both return booleans from your predicate.

Ramda
R.pathSatisfies(y => y > 0, ['x', 'y'], { x: { y: 2 } });
//=> true

R.pathSatisfies(y => y > 0, ['x', 'y'], { x: { y: -1 } });
//=> false

R.pathSatisfies(R.is(Object), [], { x: { y: 2 } });
//=> true

R.pathSatisfies(R.is(Number), ['x', 'y'], { x: { y: 2 } });
//=> true
Try It Yourself

How It Works

That is the docs sample from ramdajs.com. The source is pred(path(path, obj)). An empty path passes the whole object to the predicate.

Example 2 — vs propSatisfies, path, and pathEq

pathSatisfies tests with any predicate. propSatisfies is one key. path reads. pathEq checks strict equality.

Ramda
const row = { user: { name: 'Ada', age: 30 }, score: 95 };

R.pathSatisfies(R.is(String), ['user', 'name'], row);
//=> true

R.propSatisfies(R.is(String), 'name', { name: 'Ada' });
//=> true

R.path(['user', 'age'], row);
//=> 30

R.pathEq(95, ['score'], row);
//=> true
Try It Yourself

How It Works

propSatisfies is the one-key version. path returns the nested leftover without a boolean test. pathEq is equality instead of a custom predicate. Previous Logic helper is R.or.

📈 Practical Patterns

Missing paths and undefined leftovers, then filter with curry, then array indexes vs pathEq.

Example 3 — Missing Path and undefined to Predicate

When a segment is missing, R.path returns undefined. Your predicate still runs and decides the boolean.

Ramda
const obj = { x: { y: 2 } };

R.pathSatisfies(y => y > 0, ['x', 'y'], obj);
//=> true

R.pathSatisfies(y => y > 0, ['x', 'z'], obj);
//=> false

R.pathSatisfies(R.is(Number), ['x', 'y'], obj);
//=> true

R.pathSatisfies(R.is(Number), ['x', 'missing'], obj);
//=> false
Try It Yourself

How It Works

(y => y > 0)(undefined) is false. R.is(Number)(undefined) is also false. No throw — the predicate handles the missing value.

Example 4 — Filter Rows with Nested Age

Fill predicate and path first. Pass each row to the partial in R.filter.

Ramda
const rows = [
  { user: { name: 'Ada', age: 30 } },
  { user: { name: 'Bob', age: 16 } },
  { user: { name: 'Cy', age: 22 } }
];

const isAdult = R.pathSatisfies(R.gte(18), ['user', 'age']);

R.filter(isAdult, rows);
//=> first and third rows

R.filter(R.pathSatisfies(R.gte(18), ['user', 'age']), rows).length;
//=> 2
Try It Yourself

How It Works

Because pathSatisfies is arity 3, filling predicate and path leaves a function of one object. R.filter(isAdult, rows) keeps rows whose nested age passes R.gte(18).

Example 5 — Array Path Indexes vs pathEq

Paths can include numeric indexes. pathSatisfies runs your predicate on the nested leftover; pathEq checks one fixed value.

Ramda
const data = { items: ['a', 'b', 'c'], meta: { count: 3 } };

R.pathSatisfies(R.equals('b'), ['items', 1], data);
//=> true

R.pathEq('b', ['items', 1], data);
//=> true

R.pathSatisfies(R.gt(2), ['meta', 'count'], data);
//=> true

R.pathEq(2, ['meta', 'count'], data);
//=> false
Try It Yourself

How It Works

Index 1 in ['items', 1] reads the second array element. pathEq is strict equality; pathSatisfies(R.gt(2), ...) runs any predicate.

Browser Support

R.pathSatisfies() is ordinary JavaScript once Ramda is loaded. Logos use the shared browser-image-sprite.png sprite from this project.

✓ Ramda 0.19.0+ · Any JS runtime

Ramda.js R.pathSatisfies()

Load Ramda 0.19.0 or later via CDN or npm, then call R.pathSatisfies with a predicate, path, and object. No extra browser API is required.

100% With Ramda 0.19.0+
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
R.pathSatisfies() Universal

Bottom line: Safe in any project that includes Ramda 0.19.0 or later. Use a CDN build such as ramda.min.js in the browser or install ramda from npm for Node. These labs use [email protected].

Frequently Asked Questions

R.pathSatisfies(pred, path, obj) reads the nested value at path with R.path, then returns pred(value). true when the predicate passes, false otherwise. Added in v0.19.0. Type: (a → Boolean) → [Idx] → {a} → Boolean. Arity 3, curried.
R.pathSatisfies(y => y > 0, ['x', 'y'], {x: {y: 2}}) is true. R.pathSatisfies(R.is(Object), [], {x: {y: 2}}) is true because an empty path tests the whole object.
propSatisfies tests one top-level key. path reads a nested value without a test. pathEq checks strict equality to a fixed value. pathSatisfies runs any predicate on the nested leftover.
R.path returns undefined for a missing segment. The predicate still runs. For example, (y => y > 0)(undefined) is false. You get false, not a throw.
pathSatisfies names the pattern, is curried for filter and pipe, and handles the path read in one helper. R.filter(R.pathSatisfies(pred, path)) keeps rows that pass.
No. R.pathSatisfies is a stable Ramda logic helper from v0.19.0. It is not deprecated, experimental, or non-standard.

Continue to R.propSatisfies()

Learn how to test top-level properties with Ramda R.propSatisfies().

R.propSatisfies() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful