Min modifier
A modifier which creates a validation rule to ensure that a given value is longer or equal in length to the given input.
Schemas
number
: Learn morestring
: Learn moredate
: Learn morearray
: Learn more
Arguments
min
- The minimum value that the input value must be more or equal tomessage?
- A custom object with error messages to be displayed when validation fails or there are type errors
Example
import { min, number } from '@nordic-ui/validathor';
const schema = number([min(10)]);
try {
const parsedValue = schema.parse(42);
console.log('Parsed value:', parsedValue);
} catch (error) {
console.error('Parsing failed:', error.message);
}