Library to work against complex domain names, subdomains and URIs
82
Build a domain validator that can handle internationalized domain names (IDN) from various languages and provides detailed information about their structure.
Create a module that exports a function parseInternationalDomain that takes a URL, hostname, or email address string and returns an object containing:
domain: The registrable domainsubdomain: The subdomain portion (if any)publicSuffix: The public suffix (TLD)isValid: Whether the input contains a valid domainThe function should handle both Unicode and Punycode representations of international domains.
@generates
/**
* Parses international domain names from URLs, hostnames, or email addresses
*
* @param {string} input - A URL, hostname, or email address that may contain Unicode characters
* @returns {object} An object containing domain, subdomain, publicSuffix, and isValid properties
*/
function parseInternationalDomain(input) {
// Implementation here
}
module.exports = { parseInternationalDomain };Provides URL parsing and domain extraction with Unicode/IDNA support.
Install with Tessl CLI
npx tessl i tessl/npm-tldtsdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10