ValidateModifiers core function
ℹ️
This function is primarily for internal use.
Some schemas accept modifiers, such as min()
or email()
which can modify the way a schema works.
validateModifiers()
is a function used within these schemas to validate this array of modifiers easily, rather than checking them one by one in the code.
It's exposed in the library, though I've yet to find a use for it myself in external code.
Example
import { min, max } from '@nordic-ui/validathor';
import { validateModifiers } from '@nordic-ui/validathor/core/validateModifiers';
const numberModifiers = [min(2), max(12)];
validateModifiers(4, numberModifiers);