Every documentation page is available as Markdown by replacing the trailing slash of its URL with ".md" (e.g. "/guides/introduction/" becomes "/guides/introduction.md") or by requesting it with the "Accept: text/markdown" header. We also provide a machine-readable index of all Markdown resources at /llms.txt.

domain

Creates a domain name validation action.

const Action = v.domain<TInput, TMessage>(message);

Generics

Parameters

  • message TMessage

Explanation

With domain you can validate the formatting of a domain string. If the input is not a valid domain, you can use message to customize the error message.

Validates ASCII domains. Limits: 63 chars per label, 253 chars total. Internationalized domain names (IDNs) are not supported, including Punycode-encoded labels. If you need to validate a full URL (including protocol, path, query, etc.), use the url action.

Returns

Examples

The following examples show how domain can be used.

Domain schema

Schema to validate a domain.

const DomainSchema = v.pipe(
  v.string(),
  v.nonEmpty('Please enter your domain.'),
  v.domain('The domain is badly formatted.')
);

The following APIs can be combined with domain.

Schemas

Methods

Utils

Contributors

Thanks to all the contributors who helped make this page better!

  • GitHub profile picture of @yslpn

Partners

Thanks to our partners who support the project ideally and financially.

Sponsors

Thanks to our GitHub sponsors who support the project financially.

  • GitHub profile picture of @vasilii-kovalev
  • GitHub profile picture of @UpwayShop
  • GitHub profile picture of @ruiaraujo012
  • GitHub profile picture of @hyunbinseo
  • GitHub profile picture of @nickytonline
  • GitHub profile picture of @kibertoad
  • GitHub profile picture of @caegdeveloper
  • GitHub profile picture of @Thanaen
  • GitHub profile picture of @bmoyroud
  • GitHub profile picture of @ysknsid25
  • GitHub profile picture of @dslatkin