Re: [whatwg/url] URLSearchParams delete all vs delete one (#335)

I think every use case presented could be addressed with clean ergonomics, without changing the meaning of any current methods, by adding:

* `has(key, value)`: true if `key=value` is in the collection
* `delete(key, value)`: deletes one random pair (as with Guava MultiMap). Could maybe return count of remaining `key=value` pairs, or just `has(key,value)`, instead of `undefined`?
* `set(key, value1, value2, value3, ...)`: current `set` overwrites all values for the given key. Give it a rest parameter (like `Array#push`) and then I can write `url.set(key, ...url.getAll(key).filter(v => v !== value))`, which is effectively `deleteAll(key, value)`

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

Message ID: <whatwg/url/issues/335/1325661984@github.com>

Received on Wednesday, 23 November 2022 21:12:49 UTC