Is false¶
isFalse validates that a value is the boolean literal false.
It performs a strict boolean type check and then enforces literal equality. Any non-boolean value or the literal true results in a single validation event. Otherwise, it produces no validation output.
Signature¶
Through the API:
.isFalse()
And internally:
export const isFalse: ValidationRule
(value: unknown, path: FieldPath) => Promise<ReadonlyArray<JaneEvent>>
Events¶
| Event code | Description |
|---|---|
boolean.not.boolean |
Value is not a boolean |
boolean.not.false |
Value is boolean but not false |
Design rationale¶
- Provides a strict, predictable literal
falsevalidation. - First ensures the value is a boolean, then checks for exact
falsevalue. - Rejects falsy values that aren't the actual boolean
false. - Useful for enforcing strict boolean requirements.
- Never coerces or normalizes — validation is explicit and opt-in.
- Emits exactly one event per failure for clarity and composability.
- Async-compatible and returns a readonly array of
JaneEventobjects.
Invoke¶
isFalse runs only when explicitly included in a boundary or pipeline. It does not run automatically.
The rule activates when:
- The value is any JavaScript value.
- If the value is not a boolean, emits
boolean.not.boolean. - If the value is a boolean but not
false, emitsboolean.not.false. - If the value is exactly
false→ returns an empty result set.
Examples¶
Valid literal false¶
await isFalse(false, "$");
// → []
Boolean true¶
await isFalse(true, "$");
// → [
// JaneEvent{
// kind: "error",
// code: "boolean.not.false",
// path: "$",
// ...
// }
// ]
Non-boolean values¶
await isFalse("false", "$");
// → [
// JaneEvent{
// kind: "error",
// code: "boolean.not.boolean",
// path: "$",
// ...
// }
// ]
await isFalse(0, "$");
// → [
// JaneEvent{
// kind: "error",
// code: "boolean.not.boolean",
// path: "$",
// ...
// }
// ]