Const
The schema is registered in the BupkisRegistry
with the name Falsy
and
indicates that it accepts anything as valid input for evaluation.
FalsySchema.parse(false); // ✓ Valid
FalsySchema.parse(0); // ✓ Valid
FalsySchema.parse(-0); // ✓ Valid
FalsySchema.parse(0n); // ✓ Valid (BigInt zero)
FalsySchema.parse(''); // ✓ Valid (empty string)
FalsySchema.parse(null); // ✓ Valid
FalsySchema.parse(undefined); // ✓ Valid
FalsySchema.parse(NaN); // ✓ Valid
FalsySchema.parse(true); // ✗ Throws validation error
FalsySchema.parse(1); // ✗ Throws validation error
FalsySchema.parse('hello'); // ✗ Throws validation error
FalsySchema.parse({}); // ✗ Throws validation error
A Zod schema that validates falsy JavaScript values.
This schema accepts any input value but only validates successfully if the value is falsy according to JavaScript's truthiness rules. The falsy values in JavaScript are:
false
,0
,-0
,0n
,""
(empty string),null
,undefined
, andNaN
.