[whatwg/url] duplicates keys when calling `.keys()` (#444)

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