min
min(limit, [closed=true])
Effect
Restrict the min length of the detected string.
Arguments
limit(number) - The min length.[closed](boolean) - Whether it is a closed interval or not, the default istrue, which means a closed interval, it requires the detected string's length greater than or equal tolimit. If you exactly setclosedtofalse, you'll get an opened interval, it requires the detected string's length strictly greater thanlimit.
Example
const schema = racoon.string().min(3);
schema.validate('ab'); // fail
schema.validate('abc'); // pass
schema.validate('abcd'); // pass
const schema2 = racoon.string().min(3, false);
schema2.validate('ab'); // fail
schema.validate('abc'); // fail
schema.validate('abcd'); // passLast updated
Was this helpful?