min
The number is at least min (inclusive).
Signature
ts
function min(min: number, msg?: Message): Action<number>Parameters
| Parameter | Type | Description |
|---|---|---|
min | number | Minimum value |
msg | Message | Custom error message. A string with {params} or a function |
Error codes
| Code | When | Default message |
|---|---|---|
min | The number is less than min | Must be at least {min} |
You can change the texts: see Messages & i18n.
Notes
Works with numbers only. For string length use minLength.
Example
Price
ts
pipe(coerce.number(), min(0))