Extracts the subdomain segments from a URL string.
getSubdomainSegments('https://sub.example.com/path?query=123'); // ['sub', 'example']getSubdomainSegments('https://example.com/path?query=123'); // ['example']getSubdomainSegments('invalid-url'); // undefined Copy
getSubdomainSegments('https://sub.example.com/path?query=123'); // ['sub', 'example']getSubdomainSegments('https://example.com/path?query=123'); // ['example']getSubdomainSegments('invalid-url'); // undefined
Extracts the subdomain segments from a URL string.