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

    Function encodeResource

    • Encodes a resource state as a JSON string.

      If base is provided, converts absolute IRIs (matching isIRI(value, "absolute")) to internal IRIs using internalize, recursively throughout the resource structure. Otherwise, performs plain JSON serialization.

      Parameters

      Returns string

      The JSON string, with internalized IRIs if base is provided

      If resource is not a valid Resource or opts is not a valid CodecOpts

      encodeResource(
      { id: "https://example.com/products/42", name: "Widget", price: 29.99 },
      { base: "https://example.com/" }
      );
      // → '{"id":"/products/42","name":"Widget","price":29.99}'