Ramda.js R.reject() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
List

Definition

R.reject(pred, list) is the opposite of R.filter. It runs pred on every item and returns a new list without the items where the answer is true. It also works on plain objects, testing each value (official Ramda docs).

Stable since v0.1.0: R.reject is not deprecated, experimental, or non-standard. It never changes the input; it always returns a new array or object.

Syntax

Call R.reject. Start with this line.

Ramda
R.reject(pred, list) or R.reject(pred)(list)
CallWhat it does
R.reject(pred, list) or R.reject(pred)(list)Primary signature.
R.reject(...)Call the list helper.

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

Library declarations
Ramda
R.reject(pred, list) or R.reject(pred)(list)

Parameters

ParameterDescription
predRequired. Called as pred(value); a truthy result removes the item
filterableOptional. An array or plain object; omit it to get a reusable function

Return Value

Return ValueDescription
*A new array (or object) of the items where pred was falsy

Ramda Examples

Example 1 — Official: Remove Odd Numbers

The array sample from the Ramda docs: drop every odd number.

Ramda
const isOdd = (n) => n % 2 === 1;

console.log(R.reject(isOdd, [1, 2, 3, 4]));
// [2, 4]
Try It Yourself

How It Works

  1. Test. isOdd returns true when a number leaves remainder 1 after dividing by 2.
  2. Drop. 1 and 3 pass the test, so R.reject leaves them out.
  3. Keep. 2 and 4 fail the test, so they are copied into a new array.
  4. No mutation. The original array still holds [1, 2, 3, 4].

Example 2 — Official: Remove Keys from an Object

With a plain object, the test runs on each value, and passing keys are left out.

Ramda
const isOdd = (n) => n % 2 === 1;

console.log(R.reject(isOdd, { a: 1, b: 2, c: 3, d: 4 }));
// { b: 2, d: 4 }
Try It Yourself

How It Works

  1. Values only. The predicate sees 1, 2, 3, 4, never the keys.
  2. Drop keys. a and c hold odd values, so they are left out.
  3. New object. b and d are copied into a fresh object.
  4. Keys instead? To test keys too, use R.pickBy, whose predicate receives (value, key).

Example 3 — Remove Missing and Empty Values

Pair R.reject with a ready-made Ramda test to clean up data.

Ramda
console.log(R.reject(R.isNil, [1, null, 2, undefined, 3]));
// [1, 2, 3]

console.log(R.reject(R.isEmpty, ['a', '', [], 'b']));
// ['a', 'b']
Try It Yourself

How It Works

  1. isNil. R.isNil is true only for null and undefined, so those two are dropped.
  2. Zero is safe. Unlike a plain truthy check, R.isNil would keep 0 and ''.
  3. isEmpty. R.isEmpty is true for '' and [], so they are removed.
  4. Readable. Each line reads like a sentence: “reject nil”, “reject empty”.

Example 4 — Remove Finished Tasks

Drop every record whose done property is true.

Ramda
const todos = [
  { title: 'Buy milk', done: true },
  { title: 'Write docs', done: false },
  { title: 'Fix bug', done: false }
];

const open = R.reject(R.propEq(true, 'done'), todos);

console.log(R.pluck('title', open));
// ['Write docs', 'Fix bug']
Try It Yourself

How It Works

  1. Build the test. R.propEq(true, 'done') returns a function that checks task.done === true.
  2. Drop. “Buy milk” is done, so R.reject leaves it out.
  3. Keep. The two open tasks are copied into open.
  4. Show names. R.pluck('title') pulls out just the titles for display.

Example 5 — A Reusable Filter in a Pipeline

Leave out the list to get a named function you can reuse and compose.

Ramda
const dropTemp = R.reject(R.endsWith('.tmp'));
const cleanNames = R.pipe(dropTemp, R.map(R.toUpper));

console.log(dropTemp(['a.js', 'b.tmp', 'c.css']));  // ['a.js', 'c.css']
console.log(cleanNames(['x.tmp', 'y.md']));          // ['Y.MD']
Try It Yourself

How It Works

  1. Curry. R.reject(R.endsWith('.tmp')) has no list yet, so it returns a function waiting for one.
  2. Reuse. dropTemp removes 'b.tmp' because R.endsWith('.tmp') is true for it.
  3. Compose. In cleanNames, R.pipe first drops 'x.tmp', then R.map upper-cases what is left.
  4. Result. Only 'Y.MD' survives the second call.

Browser & Runtime Support

R.reject() is plain JavaScript inside Ramda 0.1.0+. It uses no browser API, so support depends only on loading Ramda. Prefer no library? Native Array.prototype.filter with a negated test does the same for arrays.

✓ Ramda 0.1.0+ · Any JS runtime

Ramda.js R.reject()

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.reject() Universal

Bottom line: Safe in any project with Ramda (check with npm ls ramda). Remember the R.propEq argument order changed in v0.29 if you upgrade. These labs load [email protected].

Frequently Asked Questions

R.reject(pred, list) returns a new list without the items for which pred returns true. It is the opposite of R.filter. The official sample R.reject(isOdd, [1, 2, 3, 4]) returns [2, 4].
R.filter keeps the items that pass the test; R.reject removes them. For the same predicate they split a list into two halves: R.filter(isOdd, [1, 2, 3, 4]) is [1, 3] and R.reject(isOdd, [1, 2, 3, 4]) is [2, 4]. Use R.partition if you need both halves at once.
No. It always returns a new array or object. The kept items are the same references as before, so it is a shallow copy: changing a kept object also changes it in the original list.
Yes. With a plain object it tests each own value and returns a new object without the keys whose value passed. R.reject(isOdd, { a: 1, b: 2, c: 3, d: 4 }) returns { b: 2, d: 4 }.
The predicate receives only the value. Wrap it with R.addIndex: R.addIndex(R.reject)((x, i) => i % 2 === 0, ['a', 'b', 'c', 'd']) returns ['b', 'd'].
No. R.reject has been a stable Ramda list function since v0.1.0. It is not deprecated, experimental, or non-standard.

Next: R.remove()

Remove a run of items starting at an index.

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