A validator for domain TLDs.
npm install domain-tld-validatorThis package provides a simple function to validate domain names based on general domain formatting rules and Top-Level Domain (TLD) verification. It checks whether a given domain is correctly formatted and contains a valid TLD.
``bash`
npm install domain-tld-validator
`ts
import { validateDomain } from "domain-tld-validator";
console.log(validateDomain("google.com")); // true
console.log(validateDomain("sub.google.com")); // true
console.log(validateDomain("go-ogle.com")); // true
console.log(validateDomain("goo gle.com")); // false
console.log(validateDomain("google.com.")); // false
console.log(validateDomain("google.whatever123")); // false
``