goldies
    Preparing search index...

    Function buildQuery

    • Build a query string from an object of data.

      Parameters

      • data: string | Record<string, string>

        The data to turn into a query string.

      Returns string

      The query string.

      const data = { param1: 'value1', param2: 'value2' };
      // returns 'param1=value1&param2=value2'
      const queryString = buildQuery(data);

      Use new URLSearchParams(data).toString(). It encodes spaces as + rather than %20 and also escapes '()!, which decode to the same values. Will be removed in goldies 6.0.