Ramda.js R.identical() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Relation

Definition

Ramda’s R.identical() answers a reference question: are these two values the exact same thing in memory? You pass two values and get back a Boolean. It is the curried form of ES6 Object.is — not deep value equality like R.equals, and not ordering like R.gte. Primitives compare by value; objects and arrays compare by reference. NaN is identical to NaN, but +0 and -0 are not. Previous helper is R.gte. Next is R.innerJoin.

The official samples cover the whole idea. R.identical(o, o) is true when both sides are the same variable. R.identical(1, 1) is true. R.identical(1, '1') is false — same numeric value, different types. R.identical([], []) is false because each [] creates a new array. R.identical(0, -0) is false. R.identical(NaN, NaN) is true.

Syntax

Call R.identical. Start with this line.

Ramda
R.identical(a, b)
CallWhat it does
R.identical(a, b)Primary signature.
R.identical(...)Call the relation helper.

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

Library declarations
Ramda
R.identical(a, b)

Parameters

ParameterDescription
aRequired. Any. First value — must be the same reference as b for true. Not mutated.
bRequired. Any. Second value to compare against. Not mutated.

Return Value

Return ValueDescription
Booleantrue when both arguments are identical (Object.is). false when they are different references or values. Always a Boolean, never undefined.

Ramda Examples

📚 Getting Started

The official Ramda samples for reference identity and edge cases.

Example 1 — Official Reference and Edge-Case Samples

Same reference, primitives, type mismatch, separate array literals, signed zero, and NaN from the Ramda docs.

Ramda
const o = {};
R.identical(o, o);
//=> true

R.identical(1, 1);
//=> true

R.identical(1, '1');
//=> false

R.identical([], []);
//=> false

R.identical(0, -0);
//=> false

R.identical(NaN, NaN);
//=> true
Try It Yourself

How It Works

That is the docs sample from ramdajs.com. Same variable twice is identical. Primitives with the same value are identical. Separate [] literals are different references. Object.is treats NaN as identical to itself and distinguishes +0 from -0.

Example 2 — vs R.equals on Separate Array Literals

Two arrays with the same contents are equal by value but not identical by reference.

Ramda
const a = [1, 2, 3];
const b = [1, 2, 3];

R.equals(a, b);
//=> true

R.identical(a, b);
//=> false
Try It Yourself

How It Works

R.equals walks both arrays and finds matching elements at every index. R.identical only checks whether both sides are the same object in memory. Use R.equals for “same contents” and R.identical for “same reference.”

📈 Practical Patterns

Object.is edge cases, finding the same reference in a list, then shared references from R.repeat.

Example 3 — vs === and Object.is on NaN and Zero

R.identical matches Object.is, not ===, on the famous edge cases.

Ramda
NaN === NaN;
//=> false
Object.is(NaN, NaN);
//=> true
R.identical(NaN, NaN);
//=> true

0 === -0;
//=> true
Object.is(0, -0);
//=> false
R.identical(0, -0);
//=> false
Try It Yourself

How It Works

R.identical is Ramda’s curried wrapper around Object.is. Strict === fails on NaN and treats +0 and -0 as equal. When those semantics matter, reach for R.identical instead of ===.

Example 4 — R.find(R.identical(ref)) in a List

Find the list element that is the exact same object as a known reference.

Ramda
const target = { id: 2, name: 'beta' };
const list = [{ id: 1 }, target, { id: 3 }];

R.find(R.identical(target), list);
//=> { id: 2, name: 'beta' }

R.find(R.identical(target), list) === target;
//=> true
Try It Yourself

How It Works

R.find passes each list element as the second argument to the partially applied predicate. R.identical(target) returns a function that tests whether each element is the same reference as target. A clone with matching fields would not match.

Example 5 — Shared Reference from R.repeat

R.repeat returns an array where every slot points at the same object.

Ramda
const obj = { count: 0 };
const repeatedObjs = R.repeat(obj, 3);

repeatedObjs[0] === repeatedObjs[1];
//=> true

R.identical(repeatedObjs[0], repeatedObjs[1]);
//=> true
Try It Yourself

How It Works

Per the Ramda repeat docs, every index shares one reference. Mutating repeatedObjs[0] affects every slot because they are identical, not separate clones. R.identical confirms the shared reference.

Browser Support

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

Load Ramda 0.15.0 or later via CDN or npm, then call R.identical with two values. Uses native Object.is semantics. No extra browser API is required.

100% With Ramda 0.15.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.identical() 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.identical(a, b) returns true when both arguments refer to the same value in memory — the curried form of Object.is. Type: a → a → Boolean. Arity 2, curried. Added in v0.15.0.
R.identical(o, o) is true. R.identical(1, 1) is true. R.identical(1, '1') is false. R.identical([], []) is false. R.identical(0, -0) is false. R.identical(NaN, NaN) is true.
R.identical checks reference identity (Object.is). R.equals walks structures for deep value equality. [1,2,3] and [1,2,3] are equal but not identical.
R.identical matches Object.is: NaN is identical to NaN, but +0 and -0 are not. === treats +0 and -0 as equal and NaN as not equal to itself.
No. R.identical does not support the R.__ placeholder. Partial-apply with a regular function: (x) => R.identical(ref, x).
No. R.identical is a stable Ramda relation helper from v0.15.0. It is not deprecated, experimental, or non-standard.

Continue to R.innerJoin()

Learn cross-list matching — filter xs by whether any ys element satisfies pred.

R.innerJoin() Method →

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