kaven-basic - v6.0.0
    Preparing search index...

    Function AddQueryParameterToURL

    • Adds or replaces a query parameter in the given URL string.

      If the parameter already exists and noReplace is false, its value will be replaced. If the parameter does not exist, it will be appended to the query string. If value is undefined, the parameter will be added without a value (e.g., ?name). The function preserves any hash fragment present in the original URL.

      Parameters

      • url: string

        The original URL string to modify.

      • name: string

        The name of the query parameter to add or replace.

      • Optionalvalue: string

        The value of the query parameter. If omitted, the parameter is added without a value.

      • noReplace: boolean = false

        If true, the function will not replace an existing parameter; it will append a new one instead. Defaults to false.

      Returns string

      The new URL string with the query parameter added or replaced.

      4.0.0

      2022-09-22