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

    Function isIRI

    • Checks if a value is a valid IRI.

      Validates IRIs according to RFC 3987 with variant-specific rules:

      • "hierarchical": Absolute with root-relative path (scheme:/...) — can be used as resolution base
      • "absolute": Hierarchical or opaque (scheme:...)
      • "internal": Root-relative (/...) or absolute
      • "relative": Any well-formed reference

      For non-absolute variants, rejects paths where .. segments would climb above the root.

      Excluded characters (per RFC 3987 § 2.2): Control characters (U+0000-U+001F, U+007F-U+009F), whitespace, and < > " { } | \ ^ `` (backtick)

      Parameters

      • value: unknown

        The value to validate as an IRI

      • variant: Variant = "relative"

        The identifier variant to validate against (default: "relative")

      Returns value is string

      true if the value is a string conforming to IRI syntax rules for the specified variant; false otherwise

      This function serves as a type guard, narrowing the type from string to IRI when used in conditional checks.