min

min(limit, [closed=true])

Effect

Restrict the min value of the detected number.

Arguments

  • limit (number) - The min value.

  • [closed] (boolean) - Whether it is a closed interval or not, the default istrue, which means a closed interval, it requires the detected number greater than or equal to limit. If you exactly set closed to false, you'll get an opened interval, it requires the detected number strictly greater than limit.

Example

const schema = racoon.number().min(10);
schema.validate(9); // fail
schema.validate(10); // pass
schema.validate(11); // pass

const schema2 = racoon.number().min(10, false);
schema2.validate(9); // fail
schema.validate(10); // fail
schema.validate(11); // pass

Last updated