Re: [whatwg/url] size (or length) for URLSearchParams (#163)

Lack of a built-in size getter results in developers writing code like this:

```js
if ([...searchParams].length !== 0) {
  // ...
}
```

as opposed to this (more efficient, but harder to read):

```js
if (!searchParams.entries().next().done) {
  // ...
}
```

A size getter could be optimized by the JS implementation so that `searchParams.size !== 0` checks could be more efficient than `[...searchParams].length !== 0`.

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

Message ID: <whatwg/url/issues/163/1172771242@github.com>

Received on Friday, 1 July 2022 22:57:39 UTC