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 (IDN) in Unicode form are not supported. 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 @antfu
  • GitHub profile picture of @UpwayShop
  • GitHub profile picture of @vasilii-kovalev
  • GitHub profile picture of @saturnonearth
  • GitHub profile picture of @ruiaraujo012
  • GitHub profile picture of @hyunbinseo
  • GitHub profile picture of @nickytonline
  • GitHub profile picture of @KubaJastrz
  • GitHub profile picture of @kibertoad
  • GitHub profile picture of @Thanaen
  • GitHub profile picture of @caegdeveloper
  • GitHub profile picture of @bmoyroud
  • GitHub profile picture of @dslatkin