Re: [whatwg/url] Splicing URLSearchParams? (#183)

That depends on whether the pattern is common. But you can simplify the above quite a bit:
```js
const url = new URL("http://domain?var=1&var=2&var=3");
url.searchParams.forEach((value, name) => {
  url.searchParams.delete(name);  
  if(someFilter(name, value)) {
    url.searchParams.append(name, value);
  }
})
```
It's a little unclear to me why the `forEach()` callback gets the arguments in such a weird order though.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/issues/183#issuecomment-269511994

Received on Wednesday, 28 December 2016 17:41:54 UTC