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