Does the predicate hold for the value you give? Returns true or false
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.
Combines two predicates with the 'and' logical operation. For instance:
Predicate.of((x: number) => x > 10).and(x => x < 20)
Unary operation to negate the predicate.
Combines two predicates with the 'or' logical operation. For instance:
Predicate.of((x: number) => x < 5).or(x => x > 10)
Generated using TypeDoc
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.