doc: unnest mime and MIMEParams from MIMEType constructor

PR-URL: https://github.com/nodejs/node/pull/47950
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Dmitry Semigradsky 2023-06-23 22:17:23 +03:00 committed by GitHub
parent e26ffe7358
commit 1746ee20ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1080,7 +1080,7 @@ console.log(String(myMIME));
// Prints: text/plain // Prints: text/plain
``` ```
#### `mime.type` ### `mime.type`
* {string} * {string}
@ -1112,7 +1112,7 @@ console.log(String(myMIME));
// Prints: application/javascript // Prints: application/javascript
``` ```
#### `mime.subtype` ### `mime.subtype`
* {string} * {string}
@ -1144,7 +1144,7 @@ console.log(String(myMIME));
// Prints: text/javascript // Prints: text/javascript
``` ```
#### `mime.essence` ### `mime.essence`
* {string} * {string}
@ -1177,7 +1177,7 @@ console.log(String(myMIME));
// Prints: application/javascript;key=value // Prints: application/javascript;key=value
``` ```
#### `mime.params` ### `mime.params`
* {MIMEParams} * {MIMEParams}
@ -1185,7 +1185,7 @@ Gets the [`MIMEParams`][] object representing the
parameters of the MIME. This property is read-only. See parameters of the MIME. This property is read-only. See
[`MIMEParams`][] documentation for details. [`MIMEParams`][] documentation for details.
#### `mime.toString()` ### `mime.toString()`
* Returns: {string} * Returns: {string}
@ -1194,7 +1194,7 @@ The `toString()` method on the `MIMEType` object returns the serialized MIME.
Because of the need for standard compliance, this method does not allow users Because of the need for standard compliance, this method does not allow users
to customize the serialization process of the MIME. to customize the serialization process of the MIME.
#### `mime.toJSON()` ### `mime.toJSON()`
* Returns: {string} * Returns: {string}
@ -1225,7 +1225,7 @@ console.log(JSON.stringify(myMIMES));
// Prints: ["image/png", "image/gif"] // Prints: ["image/png", "image/gif"]
``` ```
### Class: `util.MIMEParams` ## Class: `util.MIMEParams`
<!-- YAML <!-- YAML
added: added:
@ -1236,7 +1236,7 @@ added:
The `MIMEParams` API provides read and write access to the parameters of a The `MIMEParams` API provides read and write access to the parameters of a
`MIMEType`. `MIMEType`.
#### Constructor: `new MIMEParams()` ### Constructor: `new MIMEParams()`
Creates a new `MIMEParams` object by with empty parameters Creates a new `MIMEParams` object by with empty parameters
@ -1252,13 +1252,13 @@ const { MIMEParams } = require('node:util');
const myParams = new MIMEParams(); const myParams = new MIMEParams();
``` ```
#### `mimeParams.delete(name)` ### `mimeParams.delete(name)`
* `name` {string} * `name` {string}
Remove all name-value pairs whose name is `name`. Remove all name-value pairs whose name is `name`.
#### `mimeParams.entries()` ### `mimeParams.entries()`
* Returns: {Iterator} * Returns: {Iterator}
@ -1266,7 +1266,7 @@ Returns an iterator over each of the name-value pairs in the parameters.
Each item of the iterator is a JavaScript `Array`. The first item of the array Each item of the iterator is a JavaScript `Array`. The first item of the array
is the `name`, the second item of the array is the `value`. is the `name`, the second item of the array is the `value`.
#### `mimeParams.get(name)` ### `mimeParams.get(name)`
* `name` {string} * `name` {string}
* Returns: {string} or `null` if there is no name-value pair with the given * Returns: {string} or `null` if there is no name-value pair with the given
@ -1275,14 +1275,14 @@ is the `name`, the second item of the array is the `value`.
Returns the value of the first name-value pair whose name is `name`. If there Returns the value of the first name-value pair whose name is `name`. If there
are no such pairs, `null` is returned. are no such pairs, `null` is returned.
#### `mimeParams.has(name)` ### `mimeParams.has(name)`
* `name` {string} * `name` {string}
* Returns: {boolean} * Returns: {boolean}
Returns `true` if there is at least one name-value pair whose name is `name`. Returns `true` if there is at least one name-value pair whose name is `name`.
#### `mimeParams.keys()` ### `mimeParams.keys()`
* Returns: {Iterator} * Returns: {Iterator}
@ -1312,7 +1312,7 @@ for (const name of params.keys()) {
// bar // bar
``` ```
#### `mimeParams.set(name, value)` ### `mimeParams.set(name, value)`
* `name` {string} * `name` {string}
* `value` {string} * `value` {string}
@ -1341,13 +1341,13 @@ console.log(params.toString());
// Prints: foo=def&bar=1&baz=xyz // Prints: foo=def&bar=1&baz=xyz
``` ```
#### `mimeParams.values()` ### `mimeParams.values()`
* Returns: {Iterator} * Returns: {Iterator}
Returns an iterator over the values of each name-value pair. Returns an iterator over the values of each name-value pair.
#### `mimeParams[@@iterator]()` ### `mimeParams[@@iterator]()`
* Returns: {Iterator} * Returns: {Iterator}