From eb990efcce1e5390e4ed76b858c05c6f9b3b6c11 Mon Sep 17 00:00:00 2001 From: Lino Le Van <11367844+lino-levan@users.noreply.github.com> Date: Tue, 14 Mar 2023 13:28:33 -0700 Subject: feat(ext/url): URLSearchParams.size (#17884) --- ext/url/00_url.js | 5 +++++ ext/url/lib.deno_url.d.ts | 8 ++++++++ 2 files changed, 13 insertions(+) (limited to 'ext') diff --git a/ext/url/00_url.js b/ext/url/00_url.js index 422a23930..c288225e3 100644 --- a/ext/url/00_url.js +++ b/ext/url/00_url.js @@ -302,6 +302,11 @@ class URLSearchParams { webidl.assertBranded(this, URLSearchParamsPrototype); return ops.op_url_stringify_search_params(this[_list]); } + + get size() { + webidl.assertBranded(this, URLSearchParamsPrototype); + return this[_list].length; + } } webidl.mixinPairIterable("URLSearchParams", URLSearchParams, _list, 0, 1); diff --git a/ext/url/lib.deno_url.d.ts b/ext/url/lib.deno_url.d.ts index 329f5bf55..0181c6fb3 100644 --- a/ext/url/lib.deno_url.d.ts +++ b/ext/url/lib.deno_url.d.ts @@ -150,6 +150,14 @@ declare class URLSearchParams { * ``` */ toString(): string; + + /** Contains the number of search parameters + * + * ```ts + * searchParams.size + * ``` + */ + size: number; } /** The URL interface represents an object providing static methods used for -- cgit v1.2.3