Takes a binary function f, a unary function g, and two values — applies g to each value, then combines the results with f: f(g(a), g(b)). Also known as the P combinator. Part of Ramda Function since v0.28.0 (stable — not deprecated).
Note: Same mapper on two values, then one binary. For two mappers on one value, use R.converge.
Syntax
Call R.on. Start with this line.
Ramda
R.on(f, g, a, b) or R.on(f, g)(a, b)
Call
What it does
R.on(f, g, a, b) or R.on(f, g)(a, b)
Primary signature.
R.on(...)
Call the function helper.
Prefer import { on } from "ramda" when you want a named import.
Library declarations
Ramda
R.on(f, g, a, b) or R.on(f, g)(a, b)
Parameters
Parameter
Description
f
Required. Binary function that combines the two mapped values
g
Required. Unary function applied to each of a and b
a, b
Required. The two values to transform, then combine
Return Value
Return Value
Description
*
Whatever f(g(a), g(b)) returns
Ramda Examples
Example 1 — Official eqBy
Prefill a binary equals, then compare two objects on property a.
Case fold.on(equals, toLower) compares lowered strings.
eqBy shortcut.R.eqBy(g, a, b) is equals after g.
Failing case. Props 1 and 2 → false.
Rule. Prefer eqBy for equality; use on for any binary f.
Compatibility
Browser & Runtime Support
R.on is a Ramda Function helper since v0.28.0. It runs anywhere Ramda 0.28+ runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install ramda.
✓ Stable · Ramda 0.28.0+
R.on()
Available in full Ramda builds from v0.28.0 onward. Works in evergreen browsers and current Node LTS when Ramda is loaded.
100%With Ramda 0.28+
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.onRamda 0.28.0+
Bottom line: Safe for production on Ramda 0.28+. Ideal for case-insensitive compares, property compares, and any f(g(a), g(b)) pattern. Official reference: ramdajs.com/docs/#on.
Frequently Asked Questions
R.on(f, g, a, b) returns f(g(a), g(b)). g runs on each value, then the binary function f combines those two results. Also known as the P combinator. Added in v0.28.0.
on applies the same unary g to two different values, then f. converge applies several (possibly different) functions to the same arguments, then f. on(f, g, a, b) is f(g(a), g(b)). converge(f, [g, h])(x) is f(g(x), h(x)).
R.eqBy(g, a, b) is R.on(R.equals, g, a, b). eqBy is the specialized compare-after-mapping helper. on is the general combinator: any binary f, not only equals.
Yes. It is curryN(4), so R.on(f, g, a, b), R.on(f, g)(a, b), and R.on(f)(g)(a)(b) all work. The official eqBy sample pre-fills only f.
No. R.on is a stable Ramda Function helper from v0.28.0. It is not deprecated, experimental, or non-standard.