A predicate is a function taking one parameter and returning a boolean.
In other words the predicate checks whether some proposition holds for the parameter.
The Predicate interface offers normal function-calling, to make sure that the
predicate holds (just call predicate(x)), but also some helper methods to
deal with logical operations between propositions.
You can build predicates using PredicateStatic through the
'Predicate' global constant.
A predicate is a function taking one parameter and returning a boolean. In other words the predicate checks whether some proposition holds for the parameter.
The Predicate interface offers normal function-calling, to make sure that the predicate holds (just call predicate(x)), but also some helper methods to deal with logical operations between propositions.
You can build predicates using PredicateStatic through the 'Predicate' global constant.
Examples:
const check = Predicate.of((x: number) => x > 10).and(x => x < 20); check(12); // => true check(21); => false Vector.of(1,2,3,4,5).filter( Predicate.isIn([2,3]).negate()) => Vector.of(1, 4, 5)