Ramda.js R.propEq() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Relation

Definition

Ramda’s R.propEq() answers a top-level equality question: does this property hold this value? You pass the expected value, a property name, then the object. Ramda reads the field with R.prop and compares with R.equals. You get true or false. Native code would read obj[name] and then use ===, which fails for object and array properties. The docs note you can test multiple properties with R.whereEq, and a nested path with R.pathEq.

The official sample is the whole idea. Build four kids, then const hasBrownHair = R.propEq('brown', 'hair'); and R.filter(hasBrownHair, kids) keeps Fred and Rusty. Need a nested path? That is R.pathEq. Need any predicate, not a fixed value? That is R.propSatisfies. Need to read without a test? That is R.prop. Flat object spec? R.whereEq. Previous helper is R.pathEq. Next is R.sortBy.

Syntax

Call R.propEq. Start with this line.

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

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

Library declarations
Ramda
R.propEq(val, name, obj)

Parameters

ParameterDescription
valRequired. Any. Value to compare the property with, using R.equals.
nameRequired. String. Object property key, such as 'hair', 'age', or 'name'.
objRequired. Object. The record to check. A missing key makes R.prop return undefined.

Return Value

Return ValueDescription
Booleantrue if val equals the specified object property. Otherwise false. The object is not mutated.

Ramda Examples

📚 Getting Started

The official Ramda brown-hair filter, then one top-level key vs a nested path.

Example 1 — Official Brown-Hair Filter Sample

From the Ramda docs. Fill value and name first. R.filter keeps kids whose hair equals 'brown'.

Ramda
const abby = { name: 'Abby', age: 7, hair: 'blond' };
const fred = { name: 'Fred', age: 12, hair: 'brown' };
const rusty = { name: 'Rusty', age: 10, hair: 'brown' };
const alois = { name: 'Alois', age: 15, disposition: 'surly' };
const kids = [abby, fred, rusty, alois];
const hasBrownHair = R.propEq('brown', 'hair');

R.filter(hasBrownHair, kids);
//=> [fred, rusty]
Try It Yourself

How It Works

That is the docs sample from ramdajs.com. hasBrownHair is a function of one object. Abby is blond. Alois has no hair key, so the leftover is undefined and the row is dropped.

Example 2 — vs R.pathEq

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]. Previous helper is R.pathEq.

📈 Practical Patterns

Equality vs any predicate vs read-only, missing keys and deep equals, then curried find and filter.

Example 3 — vs R.propSatisfies and R.prop

Equality vs any predicate vs read-only. Same top-level age, three different questions.

Ramda
const abby = { name: 'Abby', age: 7, hair: 'blond' };

R.propEq(7, 'age', abby);
//=> true

R.propSatisfies(R.equals(7), 'age', abby);
//=> true

R.propSatisfies(n => n > 5, 'age', abby);
//=> true

R.prop('age', abby);
//=> 7
Try It Yourself

How It Works

propEq is the named equality helper. propSatisfies(R.equals(7), ...) does the same job with an explicit predicate. A range check such as n > 5 needs propSatisfies. prop returns the leftover, not a Boolean.

Example 4 — Missing Key and Deep R.equals

A missing property is undefined, so equals fails and you get false. Object and array properties match by value.

Ramda
const abby = { name: 'Abby', age: 7, hair: 'blond' };
const alois = { name: 'Alois', age: 15, disposition: 'surly' };
const row = { tags: ['js', 'fp'] };

R.propEq('blond', 'hair', abby);
//=> true

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

R.propEq('brown', 'hair', alois);
//=> false

R.prop('hair', alois);
//=> undefined
Try It Yourself

How It Works

['js', 'fp'] is a different array from the one inside row, but R.equals still returns true. === would be false. Alois has no hair key, so prop yields undefined and propEq is false.

Example 5 — Curried R.find and R.filter

Fill value and name first. Pass each row to the partial in R.find or R.filter.

Ramda
const abby = { name: 'Abby', age: 7, hair: 'blond' };
const fred = { name: 'Fred', age: 12, hair: 'brown' };
const rusty = { name: 'Rusty', age: 10, hair: 'brown' };
const alois = { name: 'Alois', age: 15, disposition: 'surly' };
const kids = [abby, fred, rusty, alois];

R.find(R.propEq(7, 'age'), kids);
//=> abby

R.filter(R.propEq('brown', 'hair'), kids);
//=> [fred, rusty]
Try It Yourself

How It Works

Because propEq is arity 3, filling 7 and 'age' leaves a function of one object. Data last is the Ramda style. Name the partial const isSeven = R.propEq(7, 'age') when the call site should read clearly.

Browser Support

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

✓ Ramda 0.1.0+ · Any JS runtime

Ramda.js R.propEq()

Load Ramda 0.1.0 or later via CDN or npm, then call R.propEq with a value, property name, and object. No extra browser API is required.

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

Bottom line: Safe in any project that includes Ramda 0.1.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 name, then object.

Frequently Asked Questions

R.propEq(val, name, obj) returns true when the top-level property name equals val in R.equals terms. Type: a → String → Object → Boolean. Arity 3, curried. Added in v0.1.0. Most often used to filter a list of records.
const hasBrownHair = R.propEq('brown', 'hair'); R.filter(hasBrownHair, kids) keeps Fred and Rusty. Abby is blond; Alois has no hair key and is dropped.
Value first, then name, then object: R.propEq(val, name, obj). Older Ramda took the name first. Labs and this site use 0.30.1 — do not copy name-first snippets from old blog posts.
pathEq tests a nested path. propSatisfies runs any predicate on one top-level key. prop reads the value with no Boolean. propEq is top-level equality via R.equals. Multiple keys: whereEq.
R.equals — deep equality. Object and array property values match by value, not by reference. A missing key yields undefined, which typically fails the equals check and returns false.
No. R.propEq is a stable Ramda relation helper from v0.1.0. It is not deprecated, experimental, or non-standard.

Continue to R.sortBy()

Project a sort key, then get a new array in ascending order — without mutating the original list.

R.sortBy() →

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