allowInfinity
allowInfinity()
Effect
This is similar to allowNaN. By default, number doesn't allow the detected value to be Infinity. If you want Infinity to be allowed, you should call allowInfinity.
Arguments
None
Example
const schema1 = racoon.number();
schema1.validate(Infinity); // fail
schema1.validate(-Infinity); // fail
const schema2 = racoon.number().allowInfinity();
schema1.validate(Infinity); // pass
schema1.validate(-Infinity); // passLast updated
Was this helpful?