⚠️ This project is still in early alpha. Please report bugs on GitHub.

Modifiers
Min

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

Arguments

  • min (number | date): The minimum value that the input value must be more or equal to.
  • message (Optional): 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);
}