gatsby-source-prismic
Version:
Gatsby source plugin for building websites using Prismic as a data source
16 lines (13 loc) • 381 B
text/typescript
/**
* Removes a URL parameter from a given URL.
*
* @param url - URL to modify.
* @param paramKey - Key of the URL parameter to remove.
*
* @returns `url` without the `paramKey` URL parameter.
*/
export const removeURLParameter = (url: string, paramKey: string) => {
const instance = new URL(url);
instance.searchParams.delete(paramKey);
return instance.toString();
};