Node.js URL.domainToUnicode
Last Updated :
14 Oct, 2021
The url.domainToUnicode is an inbuilt application programming interface of class URL with in url module.
It returns the Unicode serialization of the domain. If the domain is invalid, the empty string is returned.
Syntax :
const url.domainToASCII
Domain value : string
Return value : string
Example :
const url = require( 'url' );
console.log(url.domainToUnicode( 'xn--espaol-zwa.com' ));
console.log(url.domainToUnicode( 'xn--fiq228c.com' ));
console.log(url.domainToUnicode( 'xn--iñvalid.com' ));
|
OUTPUT:
español.com
??.com
//Empty String will be printed for third case
Note : It performs the inverse operation to url.domainToASCII().
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...