0.2.0 • Published 4 years ago

get-apex-domain-name v0.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

get-apex-domain-name

Robustly parses the root / apex domain name of a URL without the TLD.

NPM Build Status JavaScript Style Guide

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