minLength
Named Props
Parameters
Usage
import validate, {minLength} from 'strickland';
// As a value parameter
const minLengthOf3 = minLength(3);
// As a named prop
const minLengthOf2 = minLength({
minLength: 2,
message: 'Must have a length of at least 2'
});
// As a function that resolves to have the named prop
const minLengthValidator = minLength((context) => ({
minLength: context.minLength,
message: `Must have a length of at least ${context.minLength}`
}));Last updated