mirror of
https://github.com/github/codeql-action.git
synced 2026-01-03 21:20:09 +08:00
12 lines
322 B
TypeScript
12 lines
322 B
TypeScript
/**
|
|
* 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);
|
|
}
|