export enum UtmType {
UtmSource = 'utm_source',
UtmMedium = 'utm_medium',
}
const url = '?utm_source=stop&utm_medium=get&utm_delete=delete'
const params = new URLSearchParams(url)
for (const key of utm) {
params.delete(key);
}
const href = 'https://example.com/?user=John&some_key=1&id=3';
const url = new URL(href);
const availableKeys = ['user', 'id'];
for (const key of [...url.searchParams.keys()]) {
if (!availableKeys.includes(key)) {
url.searchParams.delete(key);
}
}
console.log(url.toString()); // 'https://example.com/?user=John&id=3'