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

    Function resolve

    • Resolves a reference against a base identifier.

      • Hierarchical identifiers: Implements RFC 3986 § 5 reference resolution, combining base and reference to produce an absolute identifier
      • Opaque identifiers (e.g., urn:, mailto:): Absolute references are returned unchanged; relative references cannot be resolved and throw an error

      Type Parameters

      • T extends string

        The identifier type (URI or IRI)

      Parameters

      • base: string | T

        The absolute base identifier to resolve against

      • reference: string | T

        The reference to resolve

      Returns T

      The resolved absolute identifier

      While RFC 3986 § 5 defines a path-merging algorithm that technically applies to all URI schemes, opaque identifiers lack a hierarchical path structure, making relative resolution semantically undefined in practice. The WHATWG URL Standard follows RFC 6454, which assigns opaque origins (serialized as the string "null") to such URIs, explicitly preventing same-origin comparisons and relative resolution.

      This implementation aligns with WHATWG/URL API behavior by rejecting relative references against opaque bases, providing clearer error semantics than the underlying URL API.

      RangeError If the resolved path contains tree-climbing segments that would go above the root, or if a relative reference cannot be resolved against an opaque base