Function createPathQueryString

  • Creates a new path with query string parameters appended.

    This function generates a query string from the provided params object and optionally merges it with existing searchParams. The resulting query string is appended to the currentPath. If currentPath already contains a query string, the new parameters are appended using &.

    Parameters

    • currentPath: string

      The base path to which the query string will be appended.

    • params: { [key: string]: string | number | boolean }

      An object containing key-value pairs to be included in the query string. Values can be strings, numbers, or booleans.

    • OptionalsearchParams: null | URLSearchParams

      Optional. An existing URLSearchParams object to merge with the new parameters.

    • Optionalencode: boolean

      Optional. If true, encodes the query string values.

    Returns string

    The path with the query string appended. If no parameters are provided, returns the original currentPath.