Home > @opengovsg/validators > createEmailSchema
createEmailSchema() function
Create a schema that validates emails against RFC 5322 and a whitelist of domains.
Signature:
typescript
createEmailSchema: (options?: EmailValidatorOptions) => z.ZodType<string>Parameters
| Parameter | Type | Description |
|---|---|---|
| options | EmailValidatorOptions | (Optional) The options to use for validation |
Returns:
z.ZodType<string>
A Zod schema that validates emails according to the provided options
Exceptions
OptionsError If the options are invalid