Ramda.js R.pathEq() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Relation

Definition

Ramda’s R.pathEq() answers a nested equality question: does this path hold this value? You pass the expected value, a path array, then the object. Ramda reads the leftover with R.path and compares with R.equals. You get true or false. Native code would walk each segment and then use ===, which fails for nested objects and arrays. The docs note it is most likely used to filter a list.

The official sample is the whole idea. Build three users, then const isFamous = R.pathEq(90210, ['address', 'zipCode']); and R.filter(isFamous, users) keeps only the 90210 record. Need any predicate, not a fixed value? That is R.pathSatisfies. Need to read without a test? That is R.path. Need one top-level key? That is R.propEq. Flat object spec? R.whereEq. Previous helper is R.minBy. Next is R.propEq.

Syntax

Call R.pathEq. Start with this line.

Ramda
R.pathEq(val, path, obj)
CallWhat it does
R.pathEq(val, path, obj)Primary signature.
R.pathEq(...)Call the relation helper.

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

Library declarations
Ramda
R.pathEq(val, path, obj)

Parameters

ParameterDescription
valRequired. Any. Value to compare the nested property with, using R.equals.
pathRequired. Array of Idx. Path of the nested property, such as ['address', 'zipCode'] or ['items', 0].
objRequired. Object. The record to check. Missing segments make R.path return undefined.

Return Value

Return ValueDescription
Booleantrue if val equals the nested leftover. Otherwise false. The object is not mutated.

Ramda Examples

📚 Getting Started

The official Ramda zip-code filter, then equality vs predicate vs read-only cousins.

Example 1 — Official zipCode Filter Sample

From the Ramda docs. Fill value and path first. R.filter keeps users whose nested zip equals 90210.

Ramda
const user1 = { address: { zipCode: 90210 } };
const user2 = { address: { zipCode: 55555 } };
const user3 = { name: 'Bob' };
const users = [ user1, user2, user3 ];
const isFamous = R.pathEq(90210, ['address', 'zipCode']);

R.filter(isFamous, users);
//=> [ user1 ]
Try It Yourself

How It Works

That is the docs sample from ramdajs.com. isFamous is a function of one object. user3 has no address.zipCode, so the leftover is undefined and the row is dropped.

Example 2 — vs R.pathSatisfies and R.path

Equality vs any predicate vs read-only. Same nested zip, three different questions.

Ramda
const user = { address: { zipCode: 90210 } };
const path = ['address', 'zipCode'];

R.pathEq(90210, path, user);
//=> true

R.pathSatisfies(R.equals(90210), path, user);
//=> true

R.pathSatisfies(n => n > 90000, path, user);
//=> true

R.path(path, user);
//=> 90210
Try It Yourself

How It Works

pathEq is the named equality helper. pathSatisfies(R.equals(90210), ...) does the same job with an explicit predicate. A range check such as n > 90000 needs pathSatisfies. path returns the leftover, not a Boolean.

📈 Practical Patterns

One-key propEq vs nested path, missing paths and deep equals, then a curried nested-flag filter.

Example 3 — vs R.propEq

propEq checks one top-level key. Nested zip codes need a path array.

Ramda
const row = { name: 'Ada', address: { zipCode: 90210 } };

R.propEq('Ada', 'name', row);
//=> true

R.pathEq(90210, ['address', 'zipCode'], row);
//=> true

R.propEq(90210, 'zipCode', row);
//=> false

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

How It Works

propEq(90210, 'zipCode', row) looks for a top-level zipCode and misses the nested one. A one-segment path ['name'] on pathEq is the nested equivalent of propEq. Both helpers take value first in [email protected].

Example 4 — Missing Path and Deep R.equals

A missing path is undefined, so equals fails and you get false. Nested objects and arrays match by value.

Ramda
const user1 = { address: { zipCode: 90210 } };
const bob = { name: 'Bob' };
const row = { profile: { tags: ['js', 'fp'] } };

R.pathEq({ zipCode: 90210 }, ['address'], user1);
//=> true

R.pathEq(['js', 'fp'], ['profile', 'tags'], row);
//=> true

R.pathEq(90210, ['address', 'zipCode'], bob);
//=> false

R.path(['address', 'zipCode'], bob);
//=> undefined
Try It Yourself

How It Works

{ zipCode: 90210 } is a different object from the one inside user1, but R.equals still returns true. === would be false. Bob has no address path, so path yields undefined and pathEq is false.

Example 5 — Curried Filter on a Nested Flag

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

Ramda
const list = [
  { id: 1, meta: { active: true } },
  { id: 2, meta: { active: false } },
  { id: 3, meta: { active: true } }
];

R.filter(R.pathEq(true, ['meta', 'active']), list);
//=> first and third rows
Try It Yourself

How It Works

Because pathEq is arity 3, filling true and ['meta', 'active'] leaves a function of one object. Data last is the Ramda style. Name the partial const isActive = R.pathEq(true, ['meta', 'active']) when the call site should read clearly.

Browser Support

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

✓ Ramda 0.7.0+ · Any JS runtime

Ramda.js R.pathEq()

Load Ramda 0.7.0 or later via CDN or npm, then call R.pathEq with a value, path, and object. No extra browser API is required.

100% With Ramda 0.7.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.pathEq() Universal

Bottom line: Safe in any project that includes Ramda 0.7.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], where the argument order is value, then path, then object.

Frequently Asked Questions

R.pathEq(val, path, obj) returns true when the nested value at path equals val in R.equals terms. Type: a → [Idx] → {a} → Boolean. Idx is String, Int, or Symbol. Arity 3, curried. Added in v0.7.0. Most often used to filter a list.
const isFamous = R.pathEq(90210, ['address', 'zipCode']); R.filter(isFamous, users) keeps only the user whose nested zipCode is 90210. Users without that path are dropped.
Value first, then path, then object: R.pathEq(val, path, obj). Older Ramda took the path first. Labs and this site use 0.30.1 — do not copy path-first snippets from old blog posts.
propEq tests one top-level key. pathSatisfies runs any predicate on the nested leftover. path reads the nested value with no Boolean. pathEq is nested equality via R.equals.
R.equals — deep equality. Nested objects and arrays match by value, not by reference. A missing path yields undefined, which typically fails the equals check and returns false.
No. R.pathEq is a stable Ramda relation helper from v0.7.0. It is not deprecated, experimental, or non-standard.

Continue to R.propEq()

Learn how to test one top-level property against a value with Ramda R.propEq() — the flat cousin of pathEq.

R.propEq() 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