Ramda.js R.eqProps() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Object

Definition

Ramda’s R.eqProps() answers a one-key question: do these two objects agree on this property? You pass the key, then the first object, then the second. You get a boolean. Other keys do not matter. The comparison is R.equals, not ===, so nested objects and arrays match by structure.

The official sample is the whole idea. Two objects share c: 3 but differ on a. Native JavaScript would write o1.a === o2.a, which fails for nested values and for NaN. eqProps names the key once, stays data-last, and curries, so R.eqProps('id') is already a function of two objects — ready for R.uniqWith. One object versus a constant? That is R.propEq. Whole values? That is R.equals. Lodash _.matchesProperty is closer to propEq (value + path on one object).

Syntax

Call R.eqProps. Start with this line.

Ramda
R.eqProps(prop, obj1, obj2)
CallWhat it does
R.eqProps(prop, obj1, obj2)Primary signature.
R.eqProps(...)Call the object helper.

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

Library declarations
Ramda
R.eqProps(prop, obj1, obj2)

Parameters

ParameterDescription
propRequired. String (or key). The property name to read on both objects. Prototype properties are included, because the source uses obj[prop].
obj1Required. Object. The first record. A missing key reads as undefined.
obj2Required. Object. The second record. Compared with obj1[prop] via R.equals.

Return Value

Return ValueDescription
Booleantrue when the two property values are equal in R.equals terms. Otherwise false. Neither object is mutated.

Ramda Examples

📚 Getting Started

The official Ramda sample, then the same helper on nested values so you can see R.equals.

Example 1 — Official Property Compare

Only the named key is compared. Other fields can differ and still yield true.

Ramda
const o1 = { a: 1, b: 2, c: 3, d: 4 };
const o2 = { a: 10, b: 20, c: 3, d: 40 };

R.eqProps('a', o1, o2);
//=> false

R.eqProps('c', o1, o2);
//=> true
Try It Yourself

How It Works

o1.a is 1 and o2.a is 10, so 'a' is false. Both objects hold c: 3, so 'c' is true even though b and d differ. That is the docs sample from ramdajs.com.

Example 2 — R.equals, Not ===

Nested arrays and objects match by value. The nested references are different. NaN equals NaN.

Ramda
const left = { tags: [1, 2], meta: { ok: true } };
const right = { tags: [1, 2], meta: { ok: true } };

R.eqProps('tags', left, right);
//=> true

R.eqProps('meta', left, right);
//=> true

left.meta === right.meta;
//=> false

R.eqProps('n', { n: NaN }, { n: NaN });
//=> true
Try It Yourself

How It Works

The source is equals(obj1[prop], obj2[prop]). R.equals walks nested objects and treats NaN as equal to itself. Native === would be false for both the nested meta objects and for NaN.

📈 Practical Patterns

Missing keys, inherited properties, then a curried helper for filter and uniqWith, then the cousins propEq and equals.

Example 3 — Missing Keys and Prototypes

Two missing properties are both undefined, so the result is true. One missing is false. Inherited keys are read.

Ramda
R.eqProps('z', {}, {});
//=> true

R.eqProps('z', { z: 1 }, {});
//=> false

const proto = { role: 'dev' };
const child = Object.create(proto);
child.name = 'Ada';

R.eqProps('role', child, { role: 'dev' });
//=> true
Try It Yourself

How It Works

There is no hasOwnProperty check. {}['z'] is undefined on both sides, and R.equals(undefined, undefined) is true. Object.create still exposes role through the prototype chain, so that compare succeeds.

Example 4 — Curry, Filter, uniqWith

Fill the key (and maybe one object) to get a predicate. Map it with filter. Pass the two-object form to uniqWith.

Ramda
const sameAsAda = R.eqProps('id', { id: 7 });

sameAsAda({ id: 7, extra: true });
//=> true

R.filter(sameAsAda, [{ id: 7, n: 'a' }, { id: 8, n: 'b' }, { id: 7, n: 'c' }]);
//=> [{ id: 7, n: 'a' }, { id: 7, n: 'c' }]

R.uniqWith(R.eqProps('id'), [{ id: 1, n: 'a' }, { id: 1, n: 'b' }, { id: 2, n: 'c' }]);
//=> [{ id: 1, n: 'a' }, { id: 2, n: 'c' }]
Try It Yourself

How It Works

Because eqProps is arity 3, filling prop and obj1 leaves a function of one object for R.filter. Filling only prop leaves a function of two objects for R.uniqWith. uniqWith keeps the first row of each equal pair.

Example 5 — propEq vs equals

propEq pins a value on one object. eqProps compares two objects. equals compares the whole record.

Ramda
const user = { id: 7, name: 'Ada' };
const other = { id: 7, extra: true };

R.propEq(7, 'id', user);
//=> true

R.eqProps('id', user, other);
//=> true

R.equals(user, other);
//=> false
Try It Yourself

How It Works

In Ramda 0.30, R.propEq is (val, name, obj) — value first. Use it when you already have the number or string. Use eqProps when both sides are objects. Use R.equals when every key must match.

Browser Support

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

Load Ramda 0.1.0 or later via CDN or npm, then call R.eqProps with a key and two objects. 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.eqProps() 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].

Frequently Asked Questions

R.eqProps(prop, obj1, obj2) returns true when obj1[prop] and obj2[prop] are equal in R.equals terms. Other keys are ignored. Added in v0.1.0.
With o1 = {a:1, b:2, c:3, d:4} and o2 = {a:10, b:20, c:3, d:40}, R.eqProps('a', o1, o2) is false and R.eqProps('c', o1, o2) is true.
It uses R.equals. Nested objects and arrays match by value. NaN equals NaN. Two missing properties are both undefined, so the result is true.
propEq compares one object to a given value (value first in Ramda 0.30). eqProps compares the same key on two objects. equals compares whole values, not one property.
Arity 3 means R.eqProps('id') is a function of two objects, ready for R.uniqWith. R.eqProps('id', someUser) is a function of one object, ready for R.filter.
No. R.eqProps is a stable Ramda object helper from v0.1.0. It is not deprecated, experimental, or non-standard.

Continue to R.evolve()

Learn how to run functions on named fields of a cloned object using Ramda R.evolve().

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