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)
Call
What 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
Parameter
Description
a
Required. Any. First value — must be the same reference as b for true. Not mutated.
b
Required. Any. Second value to compare against. Not mutated.
Return Value
Return Value
Description
Boolean
true 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.
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
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.
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.
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.
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.
Compatibility
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 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.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.