allowNaN
allowNaN()
Effect
By default, number
doesn't allow the detected value to be NaN
. If you want NaN
to be allowed, you should call allowNaN
.
NOTE
If you call both
allowNaN
andrequired
, the effect is up torequired
, meansNaN
is not allowed.
Arguments
None
Example
const schema1 = racoon.number();
schema1.validate(NaN); // fail
const schema2 = racoon.number().allowNaN();
schema2.validate(NaN); // pass
const schema3 = racoon.number().allowNaN().required();
schema3.validate(NaN); // fail
Last updated
Was this helpful?