在joi中,我知道我可以做到:
.when('propertyName', {
is: 4,
then: Joi.number().required(),
otherwise: Joi.number()
.strip()
.optional()
.allow(''),
})
但是,propertyName
我不想在propertyName
大于4时触发“ then” ,而是在大于4时触发。请注意,propertyName
可以是任何浮点数,而不仅仅是整数。
代替is: 4
,做is: Joi.number().greater(4)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句