A helper that keeps only the members that pass a test and returns them in a new array — or a new object, if you pass a plain object. The original is never changed. Part of Ramda List since v0.1.0 (stable — not deprecated, experimental, or non-standard).
Why not the native method?Array.prototype.filter must be called on the data. R.filter(isEven) is curried and data-last, so it becomes a reusable step for R.pipe — and it works on objects too.
Syntax
Call R.filter. Start with this line.
Ramda
R.filter(pred, data)
Call
What it does
R.filter(pred, data)
Primary signature.
R.filter(...)
Call the list helper.
Prefer import { filter } from "ramda" when you want a named import.
Library declarations
Ramda
R.filter(pred, data)
Parameters
Parameter
Description
pred
Required. value → Boolean — truthy means "keep"
data
Required. An array, a plain object, or anything with a filter method
Return Value
Return Value
Description
*
A new array or object with only the passing members
Ramda Examples
Example 1 — Official Array Sample
Keep the even numbers.
Ramda
const isEven = n => n % 2 === 0;
console.log(R.filter(isEven, [1, 2, 3, 4]));
// → [2, 4]
Curried step.R.filter(R.prop("active")) has its test but no data yet — it waits for a list.
Truthy test.R.prop("active") returns each user’s active value, which is already true / false.
Pipe.R.pipe runs the filter first, then hands the result to R.pluck("name").
Reuse.activeNames works on any user list → ["Ada", "Lin"].
Compatibility
Browser & Runtime Support
R.filter is one of Ramda’s original List helpers, available since v0.1.0. It uses its own loop rather than the native Array.prototype.filter, so it runs anywhere Ramda runs — browsers via CDN or bundler, and Node.js / Bun / Deno with npm install ramda.
✓ Stable · Ramda 0.1.0+
R.filter()
Support depends on the Ramda version you load, not on a browser feature. Your own test must also be valid in that runtime — e.g. arrow functions need an ES2015 engine.
100%Modern browsers & runtimes
Google ChromeModern versions · Desktop & Mobile
Full support
Mozilla FirefoxModern versions · Desktop & Mobile
Full support
Apple SafariModern versions · macOS & iOS
Full support
Microsoft EdgeChromium-based
Full support
OperaModern versions
Full support
Samsung InternetModern versions · Android
Full support
Android WebViewModern WebView
Full support
Internet ExplorerNot a target for current Ramda releases
Legacy
Node.jsMaintained LTS · npm install ramda
Supported
Bunimport from "ramda"
Supported
Denoimport from "npm:ramda"
Supported
R.filterRamda 0.1.0+
Bottom line: Safe for production in any modern browser or JavaScript runtime once Ramda is loaded. The labs on this page use [email protected] from a CDN.
Frequently Asked Questions
R.filter(pred, data) returns a new array (or object) containing only the members for which pred returns a truthy value. Docs samples: R.filter(isEven, [1, 2, 3, 4]) //=> [2, 4] and R.filter(isEven, { a: 1, b: 2, c: 3, d: 4 }) //=> { b: 2, d: 4 }.
R.filter is curried and data-last, so R.filter(isEven) is a reusable function for R.pipe. It also filters plain objects by value. Unlike the native method, the predicate receives only the value — no index or array.
Yes. For a plain object it tests each own value and returns a new object with the passing keys. To filter by key, or by key and value together, use R.pickBy.
Wrap it with R.addIndex: R.addIndex(R.filter)((x, i) => i % 2 === 0, list). Plain R.filter passes only the value.
R.reject keeps the items that fail the test. R.partition returns both groups at once: [passing, failing].
No. R.filter has been part of Ramda since v0.1.0 and is stable — not deprecated, experimental, or non-standard.