function domainToUnicode
Jump to headingdomainToUnicode(domain: string): string
Returns the Unicode serialization of the domain
. If domain
is an invalid
domain, the empty string is returned.
It performs the inverse operation to domainToASCII.
import url from 'node:url';
console.log(url.domainToUnicode('xn--espaol-zwa.com'));
// Prints español.com
console.log(url.domainToUnicode('xn--fiq228c.com'));
// Prints 中文.com
console.log(url.domainToUnicode('xn--iñvalid.com'));
// Prints an empty string
Parameters Jump to heading
Jump to headingdomain: string
Return Type Jump to heading
string