hd-utils
Version:
A handy utils for modern JS developers
7 lines (6 loc) • 478 B
TypeScript
/**
* @description Exclude query parameters from a URL.
* @example excludeQueryParamFromUrl('https://foo.bar?foo=1&bar=2#hello', ['foo']); => 'https://foo.bar?bar=2#hello'
* @example excludeQueryParamFromUrl('https://foo.bar?foo=1&bar=2#hello', (name, value) => value === 2, {parseNumbers: true}); => 'https://foo.bar?foo=1#hello'
*/
export default function excludeQueryParamFromUrl(urlOrQuery: string, filter: string[] | ((key: string, value: string) => boolean)): string;