API Reference / @dasch-ng/web-utils / redactUrl
Function: redactUrl()
redactUrl(
value,options?):string
Defined in: redact-url.ts:37
Removes secret query parameters and the fragment from an absolute http(s) URL, e.g. before sending page URLs to analytics or logs. Other strings are returned unchanged.
Parameters
value
string
options?
RedactUrlOptions = {}
Returns
string
Example
typescript
redactUrl('https://example.com/callback?code=abc&lang=de#access_token=x');
// 'https://example.com/callback?lang=de'
redactUrl(url, { params: [...SECRET_URL_PARAMS, 'email'] });