Function: addQueryParam()
ts
function addQueryParam(
url,
key,
value): string;Adds a query parameter to a URL string.
Parameters
| Parameter | Type | Description |
|---|---|---|
url | string | The source URL. |
key | string | The query parameter name. |
value | string | The query parameter value. |
Returns
string
The updated URL string.
Example
ts
addQueryParam('https://example.com', 'token', 'abc')
// => 'https://example.com/?token=abc'Since
1.0.0