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:
- Node js | OS
- Why Node.js ?
- Node | URL.domainToASCII
- Node | URL.format API
- Node | URLSearchParams.get()
- Node | URL.resolve(from,to) API
- Node | URL.hostname API
- Node | URL.host API
- Node | URL.hash API
- Node | URL.pathname API
- Node | URL.port API
- Node | URL.search API
- Node | URL.username API
- Node | URL.origin API
- Node | URL.password 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.



