requireValidEmail
The address is split at a single @: the domain is checked the way isValidDomain checks one, and the local part must be non-empty and free of spaces. It is a format check, not proof that the mailbox exists.
isX and nonX answer a question and never interrupt control flow; requireX and requireNonX hand the value back or throw. The scheme is explained in Validation conventions.
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The string value representing an email to validate. Can be |
|
| The message of the exception. A default is used when omitted. |
Returns
string — the same value, typed as an email address.
Throws
Exception | Condition |
|---|---|
| the value is not an email address. |
Examples
What passes and what does not
See also
Source
This documentation was generated with AI (Claude) from the library's source code.