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)
Call
What 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
Parameter
Description
val
Required. Any. Value to compare the property with, using R.equals.
name
Required. String. Object property key, such as 'hair', 'age', or 'name'.
obj
Required. Object. The record to check. A missing key makes R.prop return undefined.
Return Value
Return Value
Description
Boolean
true 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'.
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.
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.
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.
['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.
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.
Compatibility
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 ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll 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.