mirror of
https://github.com/denoland/deno.git
synced 2025-10-02 15:14:33 +00:00
check URLSearchParams.constructor
's params (#2488)
This commit is contained in:
parent
a115340288
commit
5871d22d9b
2 changed files with 18 additions and 5 deletions
|
@ -280,11 +280,11 @@ export class URLSearchParams {
|
|||
// Overload: sequence<sequence<USVString>>
|
||||
for (const tuple of init) {
|
||||
// If pair does not contain exactly two items, then throw a TypeError.
|
||||
requiredArguments(
|
||||
"URLSearchParams.constructor tuple array argument",
|
||||
tuple.length,
|
||||
2
|
||||
);
|
||||
if (tuple.length !== 2) {
|
||||
throw new TypeError(
|
||||
"URLSearchParams.constructor tuple array argument must only contain pair elements"
|
||||
);
|
||||
}
|
||||
this.append(tuple[0], tuple[1]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue