Turns a spec object of functions into one function that builds a matching object — each property (including nested ones) is filled by calling its function with the same arguments. Part of Ramda Function since v0.20.0 (stable — not deprecated).
Note: The spec is recursive: nested objects of functions become nested result objects. See also R.juxt and R.converge.
Syntax
Call R.applySpec. Start with this line.
Ramda
R.applySpec(spec)(...args)
Call
What it does
R.applySpec(spec)(...args)
Primary signature.
R.applySpec(...)
Call the function helper.
Prefer import { applySpec } from "ramda" when you want a named import.
Library declarations
Ramda
R.applySpec(spec)(...args)
Parameters
Parameter
Description
spec
Required. Object mapping keys to functions (recursively)
Return Value
Return Value
Description
*
A function that returns an object shaped like spec
Pass-through keys.qty and price return each argument.
Derived key.R.multiply(3, 12) → 36.
One call. Inputs and computed fields share the same invocation.
Pattern. Useful for DTOs, API payloads, and report rows.
Compatibility
Browser & Runtime Support
R.applySpec is a Ramda Function helper since v0.20.0. It runs anywhere Ramda runs — modern browsers (CDN or bundle) and Node.js / Bun / Deno with npm install ramda.
✓ Stable · Ramda 0.20.0+
R.applySpec()
Available in full Ramda builds from v0.20.0 onward. Works in evergreen browsers and current Node LTS when Ramda is loaded.
100%With Ramda 0.20+
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.applySpecRamda 0.20.0+
Bottom line: Safe for production once Ramda is loaded. Ideal for DTOs, metrics objects, and nested report shapes. Official reference: ramdajs.com/docs/#applySpec.
Frequently Asked Questions
R.applySpec(spec) returns a function. That function calls every function in spec with the same arguments and builds a new object with the same keys (and nested shape). Official: getMetrics(2, 4) → { sum: 6, nested: { mul: 8 } }.
const getMetrics = R.applySpec({ sum: R.add, nested: { mul: R.multiply } }); getMetrics(2, 4); //=> { sum: 6, nested: { mul: 8 } }. Added in v0.20.0. See also R.converge and R.juxt.
Yes. The spec is recursive. A nested object of functions becomes a nested object of results. That is why nested.mul is 8 in the official sample, not a top-level mul key.
R.juxt([R.add, R.multiply])(2, 4) returns an array [6, 8]. R.applySpec({ sum: R.add, mul: R.multiply })(2, 4) returns a named object { sum: 6, mul: 8 }. Same inputs, labeled vs ordered output.
R.evolve transforms properties that already exist on an object. R.applySpec builds a new object from arguments (or from one value you pass in). Evolve needs a source object of the same shape; applySpec needs a recipe of functions.
No. R.applySpec is a stable Ramda Function helper from v0.20.0. It is not deprecated, experimental, or non-standard.