1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-25 00:29:09 -05:00

feat(ext/url): URLSearchParams.size (#17884)

This commit is contained in:
Lino Le Van 2023-03-14 13:28:33 -07:00 committed by GitHub
parent 1930c09b04
commit eb990efcce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 0 deletions

View file

@ -302,6 +302,11 @@ class URLSearchParams {
webidl.assertBranded(this, URLSearchParamsPrototype); webidl.assertBranded(this, URLSearchParamsPrototype);
return ops.op_url_stringify_search_params(this[_list]); 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); webidl.mixinPairIterable("URLSearchParams", URLSearchParams, _list, 0, 1);

View file

@ -150,6 +150,14 @@ declare class URLSearchParams {
* ``` * ```
*/ */
toString(): string; toString(): string;
/** Contains the number of search parameters
*
* ```ts
* searchParams.size
* ```
*/
size: number;
} }
/** The URL interface represents an object providing static methods used for /** The URL interface represents an object providing static methods used for

View file

@ -2090,6 +2090,7 @@
"urlsearchparams-has.any.worker.html": true, "urlsearchparams-has.any.worker.html": true,
"urlsearchparams-set.any.html": true, "urlsearchparams-set.any.html": true,
"urlsearchparams-set.any.worker.html": true, "urlsearchparams-set.any.worker.html": true,
"urlsearchparams-size.any.html": true,
"urlsearchparams-sort.any.html": true, "urlsearchparams-sort.any.html": true,
"urlsearchparams-sort.any.worker.html": true, "urlsearchparams-sort.any.worker.html": true,
"urlsearchparams-stringifier.any.html": true, "urlsearchparams-stringifier.any.html": true,