Function: getQueryParam()
ts
function getQueryParam(url, key): string | null;Reads a query parameter from a URL string.
Parameters
| Parameter | Type | Description |
|---|---|---|
url | string | The source URL. |
key | string | The query parameter name. |
Returns
string | null
The parameter value, or null if missing.
Example
ts
getQueryParam('https://example.com?id=5', 'id')
// => '5'Since
1.0.0