Last active
August 7, 2019 13:09
-
-
Save hwclass/66e852f0e55be8ec1acdf6e3ee76d290 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const currentUrl = https://blacklane.com/?maintenance_mode=on&foo=baz | |
function removeQueryString(currentUrl, removeThis) { | |
const url = new URL(currentUrl); | |
const query_string = url.search; | |
const search_params = new URLSearchParams(query_string); | |
search_params.delete(maintenance_mode); | |
url.search = search_params.toString(); | |
return url.toString(); | |
} | |
removeQueryString(currentUrl, 'maintenance_mode') // "https://blacklane.com/?foo=baz" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment