@metreeca/qest - v0.9.2
    Preparing search index...

    Function decodeQuery

    • Decodes a query from a URL-safe string.

      Parses an encoded query string back into a Query object. The encoding format is auto-detected from the input string structure.

      If base is provided, resolves internal IRIs (matching isIRI(value, "internal")) to absolute IRIs using resolve(), recursively throughout the query structure. Otherwise, performs plain parsing.

      Parameters

      • json: string

        The URL-encoded Query string (JSON, base64, or form format)

      • opts: CodecOpts = {}

        Decoding options

      Returns Query

      The decoded query, with resolved IRIs if base is provided

      If json is not a string, not a valid Query, or opts is not a valid CodecOpts

      If json is malformed or unparseable

      For "form" format, the decoder accepts both canonical and shorthand forms:

      • Prefix operators (canonical): >=price=100
      • Postfix operators (shorthand): price>=100
      • Double-quoted strings (canonical): name="widget"
      • Unquoted strings (shorthand): name=widget

      Tagged strings always require the canonical "value"@tag format.

      // Form format with shorthand operators (auto-detected)
      decodeQuery("~name=widget&price>=50&^price=1&#=25");
      // → { "~name": "widget", ">=price": 50, "^price": 1, "#": 25 }