Open In App

Node.js URL.domainToUnicode

Last Updated : 14 Oct, 2021
Comments
Improve
Suggest changes
Like Article
Like
Report

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().


Next Article

Similar Reads