Ramda’s R.allPass() answers a logic question: do all of these tests pass for the same arguments? You pass an array of predicates. You get back one function. Call that leftover with a value (or several values). You get a boolean. Native JavaScript would write p1(x) && p2(x) && p3(x). allPass names that AND once, curries the leftover to the longest predicate, and short-circuits on the first false. Drop the leftover into R.filter and R.find.
The official sample is the whole idea. isQueen checks rank 'Q'. isSpade checks suit '♠︎'. Together they accept only the queen of spades. A queen of clubs fails. Need any one test to pass? That is R.anyPass. Need exactly two predicates? That is R.both. Need one predicate on every item of a list? That is R.all. Previous Object helper is R.whereEq. Next Logic helper is R.and.
Syntax
Call R.allPass. Start with this line.
Ramda
R.allPass(predicates)
Call
What it does
R.allPass(predicates)
Primary signature.
R.allPass(...)
Call the logic helper.
Prefer import { allPass } from "ramda" when you want a named import.
Library declarations
Ramda
R.allPass(predicates)
Parameters
Parameter
Description
predicates
Required. Array. Functions that return a boolean. Each is called with the same arguments you later pass to the leftover. An empty array is allowed.
Return Value
Return Value
Description
Function
A curried predicate. true when every listed predicate is true for those arguments. false at the first miss. An empty list yields a function that is always true.
Ramda Examples
📚 Getting Started
The official Ramda queen-of-spades sample, then the same idea compared with anyPass, both, and R.all.
Example 1 — Official Queen of Spades
Both predicates see the same card. Rank must be queen and suit must be spades. One miss is enough to yield false.
Clubs fail isSpade, so the leftover is false even though rank is 'Q'. Spades pass both tests. That is the docs sample from ramdajs.com. In Ramda 0.30, propEq is value then name.
Example 2 — vs anyPass, both, and R.all
Same queen of spades. allPass and both are AND. anyPass is OR. R.all walks a list with one predicate.
anyPass is true because the card is a spade even though rank is not king. both is the two-predicate form of allPass. R.all asks a different question: does every item in a list pass one function?
📈 Practical Patterns
A numeric range, a leftover whose arity is 2, then filter and find, then an empty list versus both.
Example 3 — Range, Arity, and Two Arguments
Partially applied helpers have arity 1. Unapplied binary helpers keep arity 2, so the leftover waits for two values.
R.gt(R.__, 0) has .length 1, so inRange is unary. R.equals and R.identical each have .length 2, so that leftover is curryN(2, …). R.equals(1, '1') is true in Ramda, but identical fails, so AND is false.
Example 4 — Filter and Find
Build one leftover from two field tests. Keep matching tickets. Find the first match.
Filling the predicate list leaves a function of one object for R.filter and R.find. Row 2 fails status. Row 3 fails team. Name the tests once, reuse them on every row.
Example 5 — Empty List vs both
An empty predicate list never loops, so the leftover is always true. both is the two-predicate cousin. Three tests still AND.
Vacuous truth: nothing failed, so the leftover is true. Prefer R.both when you will always have exactly two tests. Prefer allPass when the list can grow.
Compatibility
Browser Support
R.allPass() is ordinary JavaScript once Ramda is loaded. Logos use the shared browser-image-sprite.png sprite from this project.
✓ Ramda 0.9.0+ · Any JS runtime
Ramda.js R.allPass()
Load Ramda 0.9.0 or later via CDN or npm, then call R.allPass with an array of predicates. No extra browser API is required.
100%With Ramda 0.9.0+
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
R.allPass()Universal
Bottom line: Safe in any project that includes Ramda 0.9.0 or later. Use a CDN build such as ramda.min.js in the browser or install ramda from npm for Node. These labs use [email protected].
Frequently Asked Questions
R.allPass(predicates) takes an array of predicate functions and returns one new predicate. That leftover is true only when every predicate is true for the same arguments. It is AND for functions. Added in v0.9.0. Type: [(*… → Boolean)] → (*… → Boolean).
isQueen = R.propEq('Q', 'rank'); isSpade = R.propEq('♠︎', 'suit'); isQueenOfSpades = R.allPass([isQueen, isSpade]). isQueenOfSpades({rank:'Q', suit:'♣︎'}) is false. isQueenOfSpades({rank:'Q', suit:'♠︎'}) is true.
allPass is AND of a list of predicates on the same arguments. anyPass is OR of that list. both ANDs exactly two predicates. R.all runs one predicate across every item in a list.
It matches the highest .length among the predicates. R.allPass([R.gt(R.__, 0), R.lt(R.__, 10)]) has arity 1. R.allPass([R.gt, R.lt]) has arity 2 because both helpers wait for two numbers.
R.allPass([]) returns a function that is always true. There is nothing to fail, so the leftover is vacuously true — the same idea as Array.prototype.every on [].
No. R.allPass is a stable Ramda logic helper from v0.9.0. It is not deprecated, experimental, or non-standard.