Initial commit
This commit is contained in:
commit
89053153cc
8152 files changed
+2086461
No files matched your search
+11
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Returns the subdomain of a hostname string
|
||||
*/
|
||||
export default function getSubdomain(hostname: string, domain: string): string {
|
||||
// If `hostname` and `domain` are the same, then there is no sub-domain
|
||||
if (domain.length === hostname.length) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return hostname.slice(0, -domain.length - 1);
|
||||
}
|
||||
Reference in new issue
Block a user