Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

isValidDomain

A simple test to determine if a hostname is a properly-formatted domain name. Considers localhost valid for development environments.

A "valid domain" is defined here: https://url.spec.whatwg.org/#valid-domain

Regex sourced from here: https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch08s15.html

function isValidDomain(hostname: string): boolean;
§
isValidDomain(hostname: string): boolean
[src]

§Parameters

§
hostname: string
[src]
  • The hostname to validate

§Return Type

§
boolean
[src]

True if valid domain or localhost