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
allowNaNandrequired, the effect is up torequired, meansNaNis 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); // failLast updated
Was this helpful?