@metreeca/core - v0.9.19
    Preparing search index...

    Function base

    • Extracts the base identifier from a hierarchical identifier.

      Returns the scheme and authority components (the "origin" per RFC 6454) followed by a trailing slash, suitable for use as a base identifier in reference resolution. Path, query, and fragment components are discarded.

      • With authority (for example, http://example.org/a/b?q#f): returns scheme://authority/
      • Without authority (for example, app:/a/b): returns scheme:/
      • Empty authority (for example, file:///a/b): returns scheme:///

      Parameters

      • iri: string

        The hierarchical identifier to extract the base from

      Returns string | undefined

      The base as a hierarchical identifier terminated by a trailing slash, or undefined if iri is not a valid hierarchical identifier (opaque URIs, internal paths, or relative references)