API Reference

Ramda

Practical functional programming library for JavaScript with curried, data-last, and immutable helpers.

Official Documentation ↗
CompatibilityThis documentation covers version v0.30. Check the official docs for the latest API surface.

Installation

npmnpm install ramda
pnpmpnpm add ramda
yarnyarn add ramda

Methods

Ramda is a practical functional programming library for JavaScript. It emphasizes a pure, immutable, curried, data-last API that makes composition and point-free programming natural.

Key Features

  • Curried by default: Every function is auto-curried for partial application
  • Data-last: Enables clean composition and reusable transforms
  • Immutable: Operations return new values, never mutating inputs
  • Lenses: Composable accessors for nested immutable updates
  • Combinators: pipe, compose, converge, and useWith for pipelines

Errors

The official API reference declares the following error types:

  • Error (throw new Error(‘pipe requires at least one argument’)(R.pipe 未传任何函数时)) — official text: “ if (arguments.length === 0) { throw new Error(‘pipe requires at least one argument’); }” (source: https://github.com/ramda/ramda/blob/v0.30.0/source/pipe.js, fetched 2026-11-08T17:41:29+08:00)

API reference evidence

Fetched from official sources on 2026-11-08T17:41:29+08:00 via PowerShell Invoke-WebRequest 下载官方仓库 v0.30.0 的 source/map.js、filter.js、pipe.js、prop.js、propEq.js、lens.js、set.js(raw.githubusercontent.com/ramda/ramda/v0.30.0/source),Grep 提取 @sig/@param/@return 与 throw 语句.

  • R.map → signature from https://github.com/ramda/ramda/blob/v0.30.0/source/map.js; official text: “* @sig Functor f => (a -> b) -> f a -> f b * @param {Function} fn The function to be called on every element of the input list. * @param {Array} list The list to be iterated over. * @return {Array} The new list.”
  • R.filter → signature from https://github.com/ramda/ramda/blob/v0.30.0/source/filter.js; official text: “* @sig Filterable f => (a -> Boolean) -> f a -> f a * @param {Function} pred * @param {Array} filterable * @return {Array} Filterable”
  • R.pipe → signature from https://github.com/ramda/ramda/blob/v0.30.0/source/pipe.js; official text: “* @sig (((a, b, …, n) -> o), (o -> p), …, (x -> y), (y -> z)) -> ((a, b, …, n) -> z) * @param {…Function} functions * @return {Function}”
  • R.prop / R.propEq → signature from https://github.com/ramda/ramda/blob/v0.30.0/source/prop.js; official text: “* @sig Idx -> {s: a} -> a | Undefined * @param {String|Number} p The property name or array index * @param {Object} obj The object to query * @return {*} The value at obj.p. * @sig a -> String -> Object -> Boolean * @p”
  • R.lens / R.set → signature from https://github.com/ramda/ramda/blob/v0.30.0/source/lens.js; official text: “* @sig (s -> a) -> ((a, s) -> s) -> Lens s a * @param {Function} getter * @param {Function} setter * @return {Lens} * @sig Lens s a -> a -> s -> s * @param {Lens} lens * @param {} v * @param {} x * @return {*}”

FAQ

Why are Ramda functions data-last?
Data-last arguments enable currying and clean composition with R.pipe and R.compose. You configure the transformation first, then apply it to data, which suits point-free style and reusable combinators.
How is Ramda different from Lodash?
Ramda is built around currying and immutability with data-last order, encouraging functional composition. Lodash is data-first and more imperative. Ramda never mutates input; some Lodash methods mutate in place.
Is Ramda tree-shakeable?
Partially. Importing named functions from 'ramda' is tree-shakeable with modern bundlers, but the full build is large. Use ramda/es or per-function imports for the smallest bundles.