Start sharing components as a team!Share components as a team!Join Bit to build your applications faster.Get Started Free

any-pass

v0.26.1arrow_drop_down
v0.26.1
STATUS
Passing
DOWNLOADS
34
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
A year ago
SIZE
3 KB
Takes a list of predicates and returns a predicate that returns true for a
1 contributor
Install any-pass as a package?
Copied
npm i @bit/ramda.ramda.any-pass
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.dev
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
const isClub = propEq("suit", "♣");
const isSpade = propEq("suit", "♠");
const isBlackCard = anyPass([
  isClub,
  isSpade,
]);
  rank: "10",
  suit: "♣",
}); //=> true
modifieddraft
chevron_left
chevron_right
anyPass (
predicates:Array
) : Function

Takes a list of predicates and returns a predicate that returns true for a given list of arguments if at least one of the provided predicates is satisfied by those arguments.

The function returned is a curried function whose arity matches that of the highest-arity predicate.

Example
const isClub = R.propEq('suit', '♣');
     const isSpade = R.propEq('suit', '♠');
     const isBlackCard = R.anyPass([isClub, isSpade]);

     isBlackCard({rank: '10', suit: '♣'}); //=> true
     isBlackCard({rank: 'Q', suit: '♠'}); //=> true
     isBlackCard({rank: 'Q', suit: '♦'}); //=> false
Argument
predicates: Array

An array of predicates to check

Returns
Function

The combined predicate