API Reference / @evolu/common / Types / Predicate
Type Alias: Predicate()<T>
type Predicate<T> = (value) => boolean;
Defined in: packages/common/src/Types.ts:23
Checks a condition on a value and returns a boolean.
A predicate starts with an 'is' prefix, e.g., isEven
.
Example
const isEven: Predicate<number> = (n) => n % 2 === 0;
const numbers = [1, 2, 3, 4];
const evenNumbers = numbers.filter(isEven); // [2, 4]
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
value | T |
Returns
boolean