Function isSameHost

  • Determines if two URLs belong to the same host by comparing their normalized URL objects. Handles various input formats including URL objects, domain strings, relative paths, and full URLs. Returns false if either URL cannot be parsed or normalized.

    Returns

    True if both URLs have the same host, false otherwise

    Parameters

    • url1: undefined | null | string | URL

      First URL to compare

    • url2: undefined | null | string | URL

      Second URL to compare

    Returns boolean

Generated using TypeDoc