Horje
Node.js 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'));

OUTPUT:

español.com
??.com
//Empty String will be printed for third case

Note : It performs the inverse operation to url.domainToASCII().



Reffered: https://www.geeksforgeeks.org


Node.js

Related
Node.js urlObject.port API Node.js urlObject.port API
Node.js URL.resolve(from,to) API Node.js URL.resolve(from,to) API
Node.js urlObject.host API Node.js urlObject.host API
Node.js URL.format(urlObject) API Node.js URL.format(urlObject) API
Node.js URL.format API Node.js URL.format API

Type:
Geek
Category:
Coding
Sub Category:
Tutorial
Uploaded by:
Admin
Views:
9