A tiny list function that puts two values into a new array. R.pair(first, second) returns [first, second]. It does the same job as writing [a, b], but because it is a curried function, you can pass it to R.map, R.converge, and other helpers.
Status: stable since Ramda v0.18.0 — not deprecated, experimental, or non-standard.
Syntax
Call R.pair. Start with this line.
Ramda
R.pair(first, second)
Call
What it does
R.pair(first, second)
Primary signature.
R.pair(...)
Call the list helper.
Prefer import { pair } from "ramda" when you want a named import.
Join. Those two answers become the arguments of R.pair → [3, 8].
Compatibility
Browser & Runtime Support
R.pair was added in Ramda v0.18.0. Ramda’s browser build is plain ES5, so it runs in any modern browser and in Node.js / Bun / Deno with npm install ramda.
✓ Stable · Ramda 0.18.0+
R.pair()
It only creates a two-item array, so no special browser API is needed. The function has not changed since it was added.
100%With Ramda 0.18.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.pairRamda 0.18.0+
Bottom line: Safe for production with any modern Ramda release. The labs on this page use [email protected].
Frequently Asked Questions
R.pair(first, second) returns a new two-item array [first, second]. Docs sample: R.pair('foo', 'bar') //=> ['foo', 'bar'].
For a one-off value, [a, b] is fine. R.pair is a curried function, so you can pass it to R.map, R.converge, or R.zipWith, or partially apply it: R.pair('id') waits for the second value.
You get a function back, not [x, undefined]. R.pair('foo') is a function waiting for the second value, so R.pair('foo')('bar') is ['foo', 'bar'].
R.pair builds a two-item array. R.of(Array, x) wraps one value as [x]. R.objOf(key, value) builds a one-key object such as {a: 1}.
No. The array is new, but objects inside it are the same objects you passed in. Changing one changes the original too.
No. R.pair has been a stable Ramda list function since v0.18.0 — not deprecated, experimental, or non-standard.