predicate
Predicate module - Composable predicates for filtering, validation, and type narrowing.
Predicates are functions that take a value and return a boolean.
They can be composed using combinators like and, or, and not.
Example
import * as R from 'remeda'
import { gt, lt, and, where } from 'receta/predicate'
// Basic filtering
const numbers = [1, 5, 10, 15, 20]
R.filter(numbers, and(gt(5), lt(15))) // => [10]
// Object filtering
const users = [
{ age: 25, active: true },
{ age: 17, active: true },
{ age: 30, active: false }
]
R.filter(users, where({
age: gt(18),
active: Boolean
})) // => [{ age: 25, active: true }]
References
always
Re-exports always
and
Re-exports and
between
Re-exports between
by
Re-exports by
endsWith
Re-exports endsWith
eq
Re-exports eq
gt
Re-exports gt
gte
Re-exports gte
hasProperty
Re-exports hasProperty
includes
Re-exports includes
isArray
Re-exports isArray
isBoolean
Re-exports isBoolean
isDate
Re-exports isDate
isDefined
Re-exports isDefined
isEmpty
Re-exports isEmpty
isError
Re-exports isError
isFiniteNumber
Re-exports isFiniteNumber
isFunction
Re-exports isFunction
isInstanceOf
Re-exports isInstanceOf
isInteger
Re-exports isInteger
isNotEmpty
Re-exports isNotEmpty
isNull
Re-exports isNull
isNullish
Re-exports isNullish
isNumber
Re-exports isNumber
isObject
Re-exports isObject
isPromise
Re-exports isPromise
isRegExp
Re-exports isRegExp
isString
Re-exports isString
isUndefined
Re-exports isUndefined
lt
Re-exports lt
lte
Re-exports lte
matches
Re-exports matches
matchesShape
Re-exports matchesShape
neq
Re-exports neq
never
Re-exports never
not
Re-exports not
oneOf
Re-exports oneOf
or
Re-exports or
Predicate
Re-exports Predicate
PredicateSchema
Re-exports PredicateSchema
prop
Re-exports prop
satisfies
Re-exports satisfies
startsWith
Re-exports startsWith
TypePredicate
Re-exports TypePredicate
where
Re-exports where
xor
Re-exports xor