Ramda’s R.equals() answers a value-equality question: are these two values equivalent by deep structure, not just reference? You pass two values and get back a Boolean. === is shallow and uses identity for objects. R.identical is Object.is — same reference, with special NaN and zero rules. R.equals walks arrays, objects, and nested data recursively, and handles cyclical structures safely. Many list helpers such as R.difference use equals internally for membership. Previous helper is R.eqBy. Next helper is R.gt for strict greater-than ordering.
The official samples cover the whole idea. R.equals(1, 1) is true. R.equals(1, ‘1’) is false — same as === on primitives with different types. R.equals([1, 2, 3], [1, 2, 3]) is true because contents match. Cyclical objects with a.v = a also compare as equal.
Syntax
Call R.equals. Start with this line.
Ramda
R.equals(a, b)
Call
What it does
R.equals(a, b)
Primary signature.
R.equals(...)
Call the relation helper.
Prefer import { equals } from "ramda" when you want a named import.
Library declarations
Ramda
R.equals(a, b)
Parameters
Parameter
Description
a
Required. Any. First value to compare. Not mutated.
b
Required. Any. Second value to compare. Not mutated.
Return Value
Return Value
Description
Boolean
true when arguments are equivalent by value. false otherwise. Always a Boolean, never undefined.
Ramda Examples
📚 Getting Started
The official Ramda samples for primitives, arrays, and cyclical objects.
Example 1 — Official Primitives and Array Sample
Numbers, strings, and arrays from the Ramda docs. Same-type primitives match; cross-type does not. Arrays compare by value.
That is the docs sample from ramdajs.com. 1 and 1 match. 1 and ‘1’ do not — same rule as === on primitives with different types. Two array literals with the same elements are equal by value even though references differ.
Example 2 — Official Cyclical Objects
Self-referencing objects a.v = a and b.v = b compare as equal without infinite recursion.
Ramda
const a = {};
a.v = a;
const b = {};
b.v = b;
R.equals(a, b);
//=> true
Ramda tracks visited pairs to handle cycles. Both objects have one key v pointing back to themselves. The structures are equivalent, so R.equals returns true. Raw === would fail because a and b are different references.
📈 Practical Patterns
Contrast with reference equality, see equals inside list helpers, then reuse the curried form as a filter predicate.
Example 3 — vs R.identical and === on Cloned Objects
Two object literals with the same shape. Deep equality is true; reference checks are false.
Ramda
const a = { x: 1 };
const b = { x: 1 };
R.equals(a, b);
//=> true
R.identical(a, b);
//=> false
a === b;
//=> false
R.equals walks both objects and finds matching contents. R.identical is Object.is — same reference only. === on objects also compares references. Use R.identical when you need the exact same instance in memory.
Example 4 — R.difference Uses Equals
Set subtraction uses R.equals for membership. Objects match by value, not reference.
R.equals(42) is a function waiting for a second value. R.filter passes each list element. Both 42 entries match by value and are kept.
Compatibility
Browser Support
R.equals() is ordinary JavaScript once Ramda is loaded. Logos use the shared browser-image-sprite.png sprite from this project.
✓ Ramda 0.15.0+ · Any JS runtime
Ramda.js R.equals()
Load Ramda 0.15.0 or later via CDN or npm, then call R.equals with two values. No extra browser API is required.
100%With Ramda 0.15.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.equals()Universal
Bottom line: Safe in any project that includes Ramda 0.15.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.equals(a, b) returns true when two values are equivalent by deep value equality, false otherwise. Type: a → b → Boolean. Arity 2, curried. Added in v0.15.0.
R.equals(1, 1) is true. R.equals(1, '1') is false. R.equals([1, 2, 3], [1, 2, 3]) is true. Cyclical objects with a.v = a also compare as equal.
=== is shallow and uses reference identity for objects. R.equals walks structures recursively. {a:1} === {a:1} is false; R.equals says true.
R.identical is Object.is — same reference. NaN is identical to NaN, but +0 and -0 are not. R.equals treats +0 and -0 as equal and compares contents, not references.
Yes. Self-referencing objects such as a = {}; a.v = a compare correctly without infinite loops.
No. R.equals is a stable Ramda relation helper from v0.15.0. It is not deprecated, experimental, or non-standard.