Ramda.js R.flow() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Function

Definition

R.flow(seed, pipeline) takes a starting value and an array of unary functions, runs them left to right, and returns the final result (official Ramda docs). It is the “apply it now” version of R.pipe.

Stable since v0.30.0: R.flow is not deprecated, experimental, or non-standard — but it does not exist in Ramda 0.29 or older. On older versions, use R.pipe(…)(seed).

Syntax

Call R.flow. Start with this line.

Ramda
R.flow(seed, [f, g, h])
CallWhat it does
R.flow(seed, [f, g, h])Primary signature.
R.flow(...)Call the function helper.

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

Library declarations
Ramda
R.flow(seed, [f, g, h])

Parameters

ParameterDescription
seedRequired. Starting value passed to the first function
pipelineRequired. Array of unary functions, run left to right

Return Value

Return ValueDescription
*Output of the last function (or the seed if the array is empty)

Ramda Examples

Example 1 — Official Math.sqrt Pipeline

Take the square root, flip the sign, then add one — the sample from the Ramda docs.

Ramda
const result = R.flow(9, [Math.sqrt, R.negate, R.inc]);

console.log(result); // -2
Try It Yourself

How It Works

  1. Seed. 9 goes into the first step.
  2. Step 1. Math.sqrt(9) → 3.
  3. Step 2. R.negate(3) → -3.
  4. Step 3. R.inc(-3) → -2, which R.flow returns.

Example 2 — Official Full Name from an Object

Collect an object’s values, then join them into one string.

Ramda
const person = { first: 'Jane', last: 'Doe' };

const fullName = R.flow(person, [R.values, R.join(' ')]);

console.log(fullName); // "Jane Doe"
Try It Yourself

How It Works

  1. Seed. The person object enters the pipeline.
  2. Step 1. R.values → ['Jane', 'Doe'].
  3. Step 2. R.join(' ') already has its separator, so it only needs the array → 'Jane Doe'.
  4. Why it works. Pre-filling ' ' turns the two-argument join into a one-argument step.

Example 3 — Official Empty-String Fallback

Trim the input; if nothing is left, use a default name instead.

Ramda
const fullName = 'Jane Doe';
const cleanName = [R.trim, R.when(R.isEmpty, R.always(fullName))];

console.log(R.flow('    ', cleanName));  // "Jane Doe"
console.log(R.flow(' Ada ', cleanName)); // "Ada"
Try It Yourself

How It Works

  1. Reusable steps. cleanName is just an array, so both calls share it.
  2. Step 1. R.trim turns ' ' into '' and ' Ada ' into 'Ada'.
  3. Step 2. R.when checks R.isEmpty: '' is empty, so R.always(fullName) returns 'Jane Doe'.
  4. Otherwise. 'Ada' is not empty, so R.when passes it through unchanged.

Example 4 — Filter, Map, and Sum a List

Keep prices above 6, double them, then add them up — three steps, no temporary variables.

Ramda
const prices = [5, 12, 8, 20];

const total = R.flow(prices, [
  R.filter((n) => n > 6),  // [12, 8, 20]
  R.map(R.multiply(2)),    // [24, 16, 40]
  R.sum                    // 80
]);

console.log(total); // 80
Try It Yourself

How It Works

  1. Seed. The array [5, 12, 8, 20] enters the pipeline.
  2. Step 1. R.filter keeps values above 6 → [12, 8, 20].
  3. Step 2. R.map(R.multiply(2)) doubles each one → [24, 16, 40].
  4. Step 3. R.sum adds them → 80. Each step is curried, so it waits for just the list.

Example 5 — R.flow vs R.pipe

Same steps, different shape: flow returns a value now; pipe returns a function you can reuse.

Ramda
// flow: value in, result out
console.log(R.flow(9, [Math.sqrt, R.negate, R.inc])); // -2

// pipe: build a function, call it later
const run = R.pipe(Math.sqrt, R.negate, R.inc);
console.log(run(9));  // -2
console.log(run(16)); // -3
Try It Yourself

How It Works

  1. flow. The seed 9 is passed up front, so you get -2 immediately.
  2. pipe. R.pipe takes only functions and returns a new function, run.
  3. Reuse. run(9) → -2 and run(16) → 4 → -4 → -3.
  4. Rule of thumb. One value now → flow. Many values later → pipe.

Browser & Runtime Support

R.flow() is plain JavaScript inside Ramda 0.30.0+. It uses no browser API, so support depends only on loading a recent Ramda build.

✓ Ramda 0.30.0+ · Any JS runtime

Ramda.js R.flow()

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 0.30+ 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.flow() Universal

Bottom line: The only real requirement is the version. Run npm ls ramda — below 0.30.0, R.flow is undefined, so upgrade or use R.pipe(…)(seed). These labs load [email protected] from jsDelivr.

Frequently Asked Questions

R.flow(seed, [f, g, h]) passes the seed to f, passes that result to g, then to h, and returns the final value. The official sample R.flow(9, [Math.sqrt, R.negate, R.inc]) returns -2.
Both run functions left to right. R.pipe(f, g, h) returns a new function you call later, so it suits reusable pipelines. R.flow(seed, [f, g, h]) takes the value now and returns the result, so it suits one-off transforms.
No. Lodash _.flow([f, g]) returns a function, which matches Ramda's R.pipe. Ramda's R.flow(seed, [f, g]) applies the steps immediately and returns a value.
Yes. Each step receives exactly one argument: the previous result. Pre-fill extra arguments first, for example R.join(' ') or R.multiply(2), so the step only needs the incoming value.
R.flow(9, []) returns the seed 9 unchanged. Passing functions as separate arguments, like R.flow(9, Math.sqrt), throws a TypeError because the second argument must be an array.
R.flow was added in Ramda v0.30.0 and is stable. It is not deprecated, experimental, or non-standard. In older versions R.flow is undefined; use R.pipe(...fns)(seed) instead.

Next: R.identity()

Learn the named no-op that returns whatever you pass in.

R.identity() 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