A function that returns whatever you pass in — unchanged. It is the named version of the arrow functionx => x. Part of Ramda Function since v0.1.0 (stable — not deprecated, experimental, or non-standard).
Why it exists: many Ramda helpers need a function. When the right behavior is “keep the value,” pass R.identity.
Syntax
Call R.identity. Start with this line.
Ramda
R.identity(x) or pass R.identity as a callback Signature a → a
Call
What it does
R.identity(x) or pass R.identity as a callback Signature a → a
Primary signature.
R.identity(...)
Call the function helper.
Prefer import { identity } from "ramda" when you want a named import.
Library declarations
Ramda
R.identity(x) or pass R.identity as a callback Signature a → a
Parameters
Parameter
Description
x
Required. Any value; returned exactly as given
Extra args
Optional. Ignored
Return Value
Return Value
Description
*
The same x (same reference for objects)
Ramda Examples
Example 1 — Official Samples
Both lines come from the Ramda docs: a number, then the same object back.
Key function.R.countBy calls the function on each item to get a group key.
Key = value. Identity returns "a", "b", … so each vote tallies under its own name.
Sort the same way.R.sortBy compares what identity returns — the numbers themselves.
Non-mutating. Both return new results; votes is unchanged.
Compatibility
Browser & Runtime Support
R.identity is a Ramda Function helper since v0.1.0 — one of the original APIs. It runs anywhere Ramda runs: modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install ramda.
✓ Stable · Ramda 0.1.0+
R.identity()
Present in every Ramda release. Uses no browser-specific API, so support depends only on loading Ramda itself.
100%With Ramda 0.1.0+
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
BunSupported · JavaScript runtime
Supported
DenoSupported · JavaScript runtime
Supported
Node.jsSupported · Server runtime
Supported
Android WebViewSupported · Modern WebView
Full support
R.identityRamda 0.1.0+
Bottom line: Safe for production once Ramda is loaded. Use a CDN build such as ramda.min.js in the browser, or install ramda from npm for Node. The labs on this page use [email protected].
Frequently Asked Questions
R.identity(x) returns x unchanged. Its type is a → a. The official docs sample is R.identity(1); //=> 1. Ramda describes it as a good default or placeholder function.
No. R.identity(obj) === obj is true — you get the very same reference back, so mutating the result also changes the original. Use R.clone when you need a copy.
R.identity(x) returns the argument x. R.always(value) returns a function that ignores its argument and always returns value. Use identity to keep the input; use always to replace it.
They behave the same. R.identity is shorter, reads as intent (keep the value), and is one shared function instead of a new arrow on every render or call.
R.filter keeps an item when the predicate result is truthy. Identity returns the item itself, so falsy items — 0, '', null, undefined, NaN, false — are dropped. Use R.reject(R.isNil, list) if 0 and '' must stay.
No. R.identity has been part of Ramda since v0.1.0 and is stable — not deprecated, experimental, or non-standard. Lodash and Underscore offer the same helper as _.identity.