Created
January 29, 2019 13:42
-
-
Save cawa-93/620ab070b816c13fac18a5054683cbc7 to your computer and use it in GitHub Desktop.
Clear URL
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
/** | |
* @example | |
* const url = 'https://example.com/?query=val' | |
* const clearURL = new URL(url).clear('query').toString() | |
*/ | |
URL.prototype.clear = function (...params) { | |
params.forEach(param => { | |
this.searchParams.delete(param) | |
}) | |
return this | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment