Node | URL.domainToUnicode
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')); |
chevron_right
filter_none
OUTPUT:
español.com ??.com //Empty String will be printed for third case
Note : It performs the inverse operation to url.domainToASCII().
Recommended Posts:
- Why Node.js ?
- Node js | OS
- Node | URL.format API
- Node | URL.password API
- Node | URL.origin API
- Node | URL.username API
- Node | URL.search API
- Node | URL.port API
- Node | URL.pathname API
- Node.js | pop() function
- Node | URL.hostname API
- Node | URL.href API
- HTTPS in Node
- Node | URL.pathToFileURL API
- Node | URL.resolve(from,to) API
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



