@grafctory/core - v0.15.0
    Preparing search index...

    Function getIRIHost

    • Extracts the host from an identifier.

      Provides a compact label for a web address where the full identifier is too long to show, as in outbound link text.

      Parameters

      • iri: string

        The identifier to extract the host from

      Returns Optional<string>

      The host of iri in lower case, without port or user info and with internationalized names kept readable rather than punycode-encoded, or undefined if iri names no host, as for opaque identifiers such as mailto: addresses and urn: names, for relative references, and for text that is not a valid IRI

      getIRIHost("https://www.uc.pt/en/");          // "www.uc.pt"
      getIRIHost("https://Example.org:8080/a"); // "example.org"
      getIRIHost("https://città.it/"); // "città.it"
      getIRIHost("http://[::1]:8080/a"); // "[::1]"
      getIRIHost("mailto:user@example.org"); // undefined

      getIRIBase for extracting the base identifier, scheme and authority included