Ramda.js R.pipe() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Function

Definition

R.pipe(f, g, h) joins functions into one pipeline that runs left to right: each step’s result becomes the next step’s input, so R.pipe(f, g, h)(x) is h(g(f(x))) (official Ramda docs).

Stable since v0.1.0: R.pipe is not deprecated, experimental, or non-standard. For async steps, use R.pipeWith.

Syntax

Call R.pipe. Start with this line.

Ramda
R.pipe(f, g, h)(x)
CallWhat it does
R.pipe(f, g, h)(x)Primary signature.
R.pipe(...)Call the function helper.

Prefer import { pipe } from "ramda" when you want a named import.

Library declarations
Ramda
R.pipe(f, g, h)(x)

Parameters

ParameterDescription
First functionRequired. Runs first; receives all the arguments
More functionsOptional. Each runs next and receives one value

Return Value

Return ValueDescription
*Call it with your data; its .length matches the first function

Ramda Examples

Example 1 — Official Power, Negate, Increment

The first step takes two arguments; the rest take one. This is the sample from the Ramda docs.

Ramda
const f = R.pipe(Math.pow, R.negate, R.inc);

console.log(f(3, 4)); // -80
Try It Yourself

How It Works

  1. First step. Math.pow(3, 4) receives both arguments → 81.
  2. Second step. R.negate flips the sign → -81.
  3. Third step. R.inc adds 1 → -80.
  4. Read it in order. The functions run exactly as written, left to right.

Example 2 — Turn a Title into a URL Slug

Four small string steps become one readable helper.

Ramda
const toSlug = R.pipe(
  R.trim,
  R.toLower,
  R.split(' '),
  R.join('-')
);

console.log(toSlug('  Hello Ramda World  ')); // "hello-ramda-world"
Try It Yourself

How It Works

  1. Trim. R.trim removes outer spaces → "Hello Ramda World".
  2. Lowercase. R.toLower → "hello ramda world".
  3. Split. R.split(' ') → ["hello", "ramda", "world"].
  4. Join. R.join('-') glues the words with dashes → "hello-ramda-world".

Example 3 — Filter, Map, Then Sum a List

Keep the even numbers, multiply each by 10, then add them up.

Ramda
const isEven = (n) => n % 2 === 0;

const evenTimes10Total = R.pipe(
  R.filter(isEven),
  R.map(R.multiply(10)),
  R.sum
);

console.log(evenTimes10Total([1, 2, 3, 4, 5, 6])); // 120
Try It Yourself

How It Works

  1. Filter. R.filter(isEven) keeps [2, 4, 6].
  2. Map. R.map(R.multiply(10)) → [20, 40, 60].
  3. Sum. R.sum adds them → 120.
  4. Pre-filled steps. R.filter and R.map are curried, so each already has its function and waits for the list.

Example 4 — R.pipe vs R.compose

Same two functions, opposite order, different answers.

Ramda
console.log(R.pipe(R.add(1), R.multiply(2))(5));    // 12
console.log(R.compose(R.add(1), R.multiply(2))(5)); // 11
Try It Yourself

How It Works

  1. pipe (left to right). R.add(1) first: 5 + 1 = 6, then 6 × 2 = 12.
  2. compose (right to left). R.multiply(2) first: 5 × 2 = 10, then 10 + 1 = 11.
  3. Same tools. Only the direction changes.
  4. Pick one style. Many teams prefer pipe because it reads like a to-do list.

Example 5 — Reuse a Pipeline Inside R.map

A pipeline is just a function, so you can hand it to other Ramda helpers.

Ramda
const users = [{ name: 'ada' }, { name: 'linus' }];

const shoutName = R.pipe(R.prop('name'), R.toUpper);

console.log(JSON.stringify(R.map(shoutName, users))); // ["ADA","LINUS"]
Try It Yourself

How It Works

  1. Build once. shoutName reads a name with R.prop('name'), then uppercases it with R.toUpper.
  2. Map. R.map calls shoutName on each user.
  3. Per item. { name: 'ada' } → 'ada' → 'ADA'.
  4. Print. JSON.stringify shows the new array as text.

Browser & Runtime Support

R.pipe() is plain JavaScript inside Ramda 0.1.0+. It uses no browser API, so support depends only on loading Ramda.

✓ Ramda 0.1.0+ · Any JS runtime

Ramda.js R.pipe()

The UMD build (ramda.min.js) is compiled to ES5 syntax, so it runs in Chrome, Firefox, Safari, and Edge. Via npm it works in Node.js, Deno, and Bun with require or import.

100% With Ramda loaded
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
R.pipe() Universal

Bottom line: Safe in any project that loads Ramda (check with npm ls ramda). Load ramda.min.js from a CDN in the browser, or npm install ramda for Node, Deno, and Bun. These labs load [email protected].

Frequently Asked Questions

R.pipe(f, g, h) returns a new function that runs its steps left to right: f first, then g, then h. Each result becomes the input of the next step, so R.pipe(f, g, h)(x) is h(g(f(x))).
const f = R.pipe(Math.pow, R.negate, R.inc); f(3, 4) returns -80. Math.pow(3, 4) is 81, R.negate makes it -81, and R.inc adds 1 to get -80.
They do the same job in opposite directions. R.pipe runs left to right (the first function runs first). R.compose runs right to left (the last function runs first). R.pipe(R.add(1), R.multiply(2))(5) is 12, while R.compose(R.add(1), R.multiply(2))(5) is 11.
Only the first one. It receives every argument you pass to the piped function. Every later step receives just one value: the previous step's result.
Not directly. R.pipe does not wait for Promises, so the next step receives a Promise instead of a value. Use R.pipeWith(R.andThen) for async pipelines.
No. R.pipe has been a stable Ramda function helper since v0.1.0. It is not deprecated, experimental, or non-standard.

Next: R.pipeWith()

Control how each step hands its result to the next, for example with Promises.

R.pipeWith() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful