Skip to content

Commit

Permalink
doc: fix history info for URLSearchParams
Browse files Browse the repository at this point in the history
  • Loading branch information
skyclouds2001 authored Nov 13, 2024
1 parent be5a500 commit ac38343
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions doc/api/url.md
Original file line number Diff line number Diff line change
Expand Up @@ -771,10 +771,22 @@ console.log(myURL.href);

#### `new URLSearchParams()`

<!-- YAML
added:
- v7.0.0
- v6.13.0
-->

Instantiate a new empty `URLSearchParams` object.

#### `new URLSearchParams(string)`

<!-- YAML
added:
- v7.5.0
- v6.13.0
-->

* `string` {string} A query string

Parse the `string` as a query string, and use it to instantiate a new
Expand Down Expand Up @@ -881,6 +893,12 @@ new URLSearchParams([

#### `urlSearchParams.append(name, value)`

<!-- YAML
added:
- v7.0.0
- v6.13.0
-->

* `name` {string}
* `value` {string}

Expand All @@ -889,6 +907,9 @@ Append a new name-value pair to the query string.
#### `urlSearchParams.delete(name[, value])`

<!-- YAML
added:
- v7.0.0
- v6.13.0
changes:
- version:
- v20.2.0
Expand All @@ -907,6 +928,12 @@ If `value` is not provided, removes all name-value pairs whose name is `name`.

#### `urlSearchParams.entries()`

<!-- YAML
added:
- v7.3.0
- v6.13.0
-->

* Returns: {Iterator}

Returns an ES6 `Iterator` over each of the name-value pairs in the query.
Expand All @@ -918,6 +945,9 @@ Alias for [`urlSearchParams[@@iterator]()`][`urlSearchParams@@iterator()`].
#### `urlSearchParams.forEach(fn[, thisArg])`

<!-- YAML
added:
- v7.3.0
- v6.13.0
changes:
- version: v18.0.0
pr-url: https://github.com/nodejs/node/pull/41678
Expand All @@ -943,6 +973,12 @@ myURL.searchParams.forEach((value, name, searchParams) => {

#### `urlSearchParams.get(name)`

<!-- YAML
added:
- v7.0.0
- v6.13.0
-->

* `name` {string}
* Returns: {string | null} A string or `null` if there is no name-value pair
with the given `name`.
Expand All @@ -952,6 +988,12 @@ are no such pairs, `null` is returned.

#### `urlSearchParams.getAll(name)`

<!-- YAML
added:
- v7.0.0
- v6.13.0
-->

* `name` {string}
* Returns: {string\[]}

Expand All @@ -961,6 +1003,9 @@ no such pairs, an empty array is returned.
#### `urlSearchParams.has(name[, value])`

<!-- YAML
added:
- v7.0.0
- v6.13.0
changes:
- version:
- v20.2.0
Expand All @@ -984,6 +1029,12 @@ pair whose name is `name`.

#### `urlSearchParams.keys()`

<!-- YAML
added:
- v7.3.0
- v6.13.0
-->

* Returns: {Iterator}

Returns an ES6 `Iterator` over the names of each name-value pair.
Expand All @@ -1000,6 +1051,12 @@ for (const name of params.keys()) {

#### `urlSearchParams.set(name, value)`

<!-- YAML
added:
- v7.0.0
- v6.13.0
-->

* `name` {string}
* `value` {string}

Expand Down Expand Up @@ -1055,19 +1112,37 @@ console.log(params.toString());

#### `urlSearchParams.toString()`

<!-- YAML
added:
- v7.0.0
- v6.13.0
-->

* Returns: {string}

Returns the search parameters serialized as a string, with characters
percent-encoded where necessary.

#### `urlSearchParams.values()`

<!-- YAML
added:
- v7.3.0
- v6.13.0
-->

* Returns: {Iterator}

Returns an ES6 `Iterator` over the values of each name-value pair.

#### `urlSearchParams[Symbol.iterator]()`

<!-- YAML
added:
- v7.0.0
- v6.13.0
-->

* Returns: {Iterator}

Returns an ES6 `Iterator` over each of the name-value pairs in the query string.
Expand Down

0 comments on commit ac38343

Please sign in to comment.