url
Intro
Intro
The parser provides some syntax sugar for parsing url's.
Sponsor Me
If you like this project, please consider sponsoring.
Usage
The plugin supports various formats for usage.
es5
var url = require('url');
console.log(url('hostname', 'https://websanova.com')); // websanova.com
jQuery
<script src="/url/dist/jquery-url.min.js"></script>
<script>
console.log($.url('hostname')); // websanova.com
</script>
JavaScript
<script src="/url/dist/url.min.js"></script>
<script>
console.log(window.url('hostname')); // websanova.com
</script>
TLD Version
There are two versions, url.min.js
and url-tld.min.jd
. The tld
version contains a list of valid tld's making the file about 2kb larger. Alternatively the domain parts can be sniffed directly using arguments such as url('-1')
to get the tld pieces needed.
NOTE: The tld list is just for "common" tld's and does not include a full list which is quite extensive.