API reference › @evolu/common › Types › Predicate
type Predicate<T> = (value: T) => boolean;
Defined in: packages/common/src/Types.ts:90
Checks a condition on a value and returns a boolean.
A predicate starts with an 'is' prefix, e.g., isEven.
Filtering values
import { assertEqual, type Predicate } from "@evolu/common";
const isEven: Predicate<number> = (n) => n % 2 === 0;
assertEqual([1, 2, 3, 4].filter(isEven), [2, 4]);