Predicate function - Validation
The validation functions are used for conditions and rule-based validation logic.
-
These predicates support conditional validation logic rather than format or type checks.
-
Inputs may be of any type , unless otherwise specified.
-
Null , undefined , empty strings, empty arrays, and empty objects are treated explicitly and consistently.
-
Validation predicates are commonly used in forms, workflow rules, and business logic.
|
Function |
Description |
Example |
|---|---|---|
| IsRequired(value) | Returns true if the value is present and not empty/null. |
|
| IsOptional(value) | Returns true if a value is absent, null, undefined, or empty. |
|
| IsValidWhen(value, condition) | Returns true if:
|
|
| IsInvalidWhen(value, condition) | Returns true if:
|
|