max
Named Props
Parameters
Usage
import validate, {max} from 'strickland';
// As a value parameter
const maxOf3 = max(3);
// As a named prop
const maxOf2 = max({
max: 2,
message: 'Must be at most 2'
});
// As a function that resolves to have the named prop
const maxValidator = max((context) => ({
max: context.max,
message: `Must be at most ${context.max}`
}));Last updated