Extract domain informations
yarn add @aegenet/belt-extract-domain@^2.0.0
# or
npm i @aegenet/belt-extract-domain@^2.0.0
import { extractDomain } from '@aegenet/belt-extract-domain';
extractDomain(undefined)
// null
extractDomain(undefined)
// null
extractDomain('aaa.ooo.com')
// {
// domain: 'ooo.com',
// subdomains: [],
// }
extractDomain('aaa.ooo.com')
// {
// domain: 'ooo.com',
// subdomains: ['aaa'],
// }
extractDomain('deeper.aaa.ooo.com')
// {
// domain: 'ooo.com',
// subdomains: ['aaa', 'deeper'],
// }