- From: Jimmy Wärting <notifications@github.com>
- Date: Sat, 20 Jul 2019 11:10:34 -0700
- To: whatwg/url <url@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Saturday, 20 July 2019 18:10:56 UTC
Why dose `keys()` not return uniq keys? ```js var q = new URLSearchParams('a=1&a=2') var keys = Array.from(q.keys()) // ['a', 'a'] ``` loop over all keys and doing something with them would run twice ```js var q = new URLSearchParams('a=1&a=2') for (let key of q.keys()) { console.log(q.getAll(key)) // logs ['1', '2'] twice } ``` Annoying solution ```js var q = new URLSearchParams('a=1&a=2') for (let key of new Set(q.keys())) { console.log(q.getAll(key)) // logs ['1', '2'] twice } ``` -- 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/444
Received on Saturday, 20 July 2019 18:10:56 UTC