min(limit, [closed=true])
限制被检测数值的最小值。
limit(number) - 最小值
limit
[closed](boolean) - 是否闭区间,默认true, 表示闭区间,被检测值需大于或等于limit.若closed明确为false, 则表示开区间,被检测值必须严格大于limit.
[closed]
true
closed
false
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
最后更新于4年前
这有帮助吗?