Is null¶
isNull validates that a value is exactly null.
It performs a strict null check and rejects any value that is not null. If the value is not null, the rule emits a single validation event. Otherwise, it produces no validation output.
Signature¶
Through the API:
.isNull()
And internally:
export const isNull: ValidationRule
(value: unknown, path: FieldPath) => Promise<ReadonlyArray<JaneEvent>>
Events¶
| Event code | Description |
|---|---|
value.not.null |
Value is not exactly null |
Design rationale¶
- Provides a strict, predictable null value validation.
- Accepts only the exact
nullvalue. - Rejects undefined, empty strings, and other falsy values.
- 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¶
isNull 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 exactly
null, emitsvalue.not.null. - If the value is
null→ returns an empty result set.
Examples¶
Valid null value¶
await isNull(null, "$");
// → []
Undefined value¶
await isNull(undefined, "$");
// → [
// JaneEvent{
// kind: "error",
// code: "value.not.null",
// path: "$",
// ...
// }
// ]
Other values¶
await isNull("", "$");
// → [
// JaneEvent{
// kind: "error",
// code: "value.not.null",
// path: "$",
// ...
// }
// ]