I'm trying to port some js code that's using jquery-url into nodejs.
jquery-url is used to get the hostname of a given URL in this way:
var host = $.url(url).attr('host');
My question is, is there a npm package of jquery-url? if not, what already existing package has this functionality?
Thanks in advance!
Node.js already has this build in. See node Documentation.
For Example:
var url = require("url");
var host = url.parse('http://user:pass@host.com:8080/p/a/t/h?query=string#hash').host;
console.log(host);