get-apex-domain-name
v0.2.0
Published
Robustly parses the root / apex domain name of a URL without the TLD.
Downloads
2
Readme
get-apex-domain-name
Robustly parses the root / apex domain name of a URL without the TLD.
Install
npm install --save get-apex-domain-name
Usage
const getApexDomainName = require('get-apex-domain-name')
getApexDomainName('https://example.com') // 'example'
getApexDomainName('example.com') // 'example'
getApexDomainName('example.co.uk') // 'example'
getApexDomainName('https://example.dev/sub/path?foo=bar&nala=cat') // 'example'
getApexDomainName('') // null
License
MIT © Travis Fischer
Support my OSS work by following me on twitter