@metreeca/core - v0.12.0
    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

      Resolution never escapes the root of base: .. segments climbing above it are clipped as prescribed by the RFC 3986 § 5.4.2 abnormal examples, so the resolved identifier always carries the scheme and authority of base.

      Parameters

      • base: string

        The absolute base identifier to resolve against

      • reference: string

        The reference to resolve

      Returns string

      The resolved absolute identifier

      While RFC 3986 § 5 defines a path-merging algorithm that technically applies to all URI schemes, opaque identifiers lack the hierarchical path such merging operates on, leaving relative resolution semantically undefined: a relative reference against an opaque base is rejected outright, rather than resolved to an identifier its scheme gives no meaning to.

      RangeError If base is not a valid absolute identifier or reference is not a valid relative reference, for instance because it carries an isolated UTF-16 surrogate or opens with //

      RangeError If a relative reference cannot be resolved against an opaque base