I’m trying to extend a built-in javascript function via prototype, but when I attempt to refer to this
, Window
is returned. Given that I don’t really have access to rewrite the implementation, are there any ways to get around this?
Specifically I’m trying to extend URLSearchParams
in such a way that it unsets values properly. Something like:
URLSearchParams.prototype.setOrUnset = (key, val) => {
if(val){
this.set(key, val)
} else {
this.delete(key)
}
}