Skip to main content

getSubdomain

Callable

  • getSubdomain(name: string, apexName: string): null | string

  • Gets the subdomain from a domain name.

    @example
    getSubdomain('sub.example.com', 'example.com'); // 'sub'
    getSubdomain('example.com', 'example.com'); // null
    getSubdomain('www.example.com', 'example.com'); // 'www'