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