required()
Restrict the detected value is not undefined | null.
undefined | null
None
const schema1 = racoon.number(); schema1.validate(undefined); // pass, return undefined schema1.validate(null); // pass, return null const schema2 = racoon.number().required(); schema2.validate(undefined); // fail schema2.validate(null); // fail
Last updated 3 years ago