Guide · Open source
How to use Ramda: install, pipelines and currying basics
Updated · written with AI from the project's own documentation and checked against our catalogue data
Ramda is a JavaScript library of helper functions for transforming data in a functional style. Its functions are automatically curried and take the data as the last argument, so you can chain small functions into pipelines. This guide shows how to install it, import it, and build simple transformations, so you can judge whether this style suits your project.
Quick start
- 1Check Node.js. Make sure Node.js is installed, since the README lists it as the prerequisite for the npm install.
- 2Install the package. Run npm install ramda in your project folder.
- 3Import the library. Use import * as R from 'ramda' or import only the functions you need by name.
- 4Write a curried function. Call a Ramda function with some arguments to get back a new function waiting for the data.
- 5Chain functions on your data. Pass the data as the last argument so small functions can run in sequence without changing the original data.
Install Ramda with npm
Ramda is installed as an npm package. You need Node.js, then run the install command in your project folder.
- Requires Node.js
- Installs from the npm registry as the package named ramda
$ npm install ramdaImport Ramda in Node or a module project
Since version 0.25, Ramda has no default export. Import the whole library as a namespace, or import only the functions you need.
The README notes that destructuring does not necessarily prevent importing the entire library. For smaller bundles, it recommends a bundler with tree-shaking, or a plugin such as babel-plugin-ramda.
- Use import * as R from 'ramda' to load everything
- Use import { functionName } from 'ramda' to pick functions
- Do not write import R from 'ramda', since there is no default export after 0.25
import * as R from 'ramda'
const {identity} = R
R.map(identity, [1, 2, 3])Use Ramda in the browser or Deno
For the browser, add a script tag. The script adds the variable R to the global scope. The README also lists Deno and Nest.land imports and a bookmarklet for injecting Ramda into a page.
The README warns that using the latest tag on a CDN carries a significant risk of breaking changes, so pin a specific version in production.
- Script tag: ramda.js or the minified ramda.min.js
- CDNs listed in the README include cdnjs and jsDelivr
- Deno imports are available from deno.land/x and nest.land
<script src="path/to/yourCopyOf/ramda.min.js"></script>Build a pipeline from small functions
Ramda functions are automatically curried. If you supply fewer arguments than a function needs, you get back a new function waiting for the rest. The data is generally the last argument, which makes it easy to pass data along a chain of functions.
Ramda never mutates the data you pass in, so each step returns a new value and the original stays unchanged.
- Partial application: supply some arguments now, the data later
- Curried functions can be combined into a larger function
- The README says Ramda does not enforce immutability; it encourages a style that avoids mutation
Decide if Ramda fits your project
Ramda suits JavaScript developers who want functional-style data transformations and small composable functions. The README says it is focused on functional style specifically rather than being a general-purpose toolkit.
Currying and composition take practice to read. If you are new to functions as values, expect a learning curve. Comparable options named in the source include lodash/fp, Immutable.js, Crocks and Underscore.js.
- Good fit: teams that prefer immutable data handling
- Less suited: developers who want a toolkit that mixes paradigms
- Less suited: projects that need the library to enforce immutability
Test and build Ramda itself
If you want to work on Ramda's source, the README describes running the test suite with mocha, or with npm test after installing dependencies. Browser testing uses testem. A partial build can include only the functions you name, for example compose, reduce and filter.
- npm run build creates the es and src directories and updates the dist files
- npm test runs the suite after npm install
npm run --silent partial-build compose reduce filter > dist/ramda.custom.jsWhat people use it for
- Transforming arrays of plain JavaScript objects in a functional style
- Building reusable functions by partially applying Ramda helpers
- Composing small steps into a data pipeline that never mutates its input
- Loading Ramda in a browser page with a script tag for quick experiments
Frequently asked questions
Is Ramda free to use?
Ramda is released under the MIT licence, as listed on its project page. Check the licence file in the repository for the full terms.
What do I need to install Ramda?
The README lists Node.js as the prerequisite. Install the package with npm install ramda.
How do I import Ramda?
Since version 0.25 there is no default export, so use import * as R from 'ramda' or import named functions such as import { functionName } from 'ramda'.
Does Ramda change my data?
Ramda is designed so it never mutates the data you pass in. The README also says it does not enforce immutability, so the discipline is up to your code.
What are alternatives to Ramda?
The source names lodash/fp, Immutable.js, Fantasy Land-compatible libraries such as Crocks, and Underscore.js as comparable projects. Pick based on whether you want a functional-only library or a general toolkit.
Can I use Ramda in the browser without npm?
Yes. The README shows a script tag for ramda.js or ramda.min.js, and CDN links from cdnjs and jsDelivr. It warns against using the latest tag in production because of possible breaking API changes.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Ramda suits JavaScript developers and teams who want functional-style, composable data transformations that don't mutate input. It is a poor fit if you want a general-purpose toolkit mixing paradigms, or if you are new to functions as values and not ready for currying and composition.
Install options & downloads