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;