Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: specify definite Array types #19895

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,8 @@ changes:
description: The elements of `list` can now be `Uint8Array`s.
-->

* `list` {Array} List of `Buffer` or [`Uint8Array`] instances to concat.
* `list` {Buffer[] | Uint8Array[]} List of `Buffer` or [`Uint8Array`] instances
to concat.
* `totalLength` {integer} Total length of the `Buffer` instances in `list`
when concatenated.
* Returns: {Buffer}
Expand Down Expand Up @@ -756,7 +757,7 @@ console.log(bufA.length);
added: v5.10.0
-->

* `array` {Array}
* `array` {integer[]}

Allocates a new `Buffer` using an `array` of octets.

Expand Down
8 changes: 4 additions & 4 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,12 @@ changes:
-->

* `modulePath` {string} The module to run in the child.
* `args` {Array} List of string arguments.
* `args` {string[]} List of string arguments.
* `options` {Object}
* `cwd` {string} Current working directory of the child process.
* `env` {Object} Environment key-value pairs.
* `execPath` {string} Executable used to create the child process.
* `execArgv` {Array} List of string arguments passed to the executable.
* `execArgv` {string[]} List of string arguments passed to the executable.
**Default:** `process.execArgv`.
* `silent` {boolean} If `true`, stdin, stdout, and stderr of the child will be
piped to the parent, otherwise they will be inherited from the parent, see
Expand Down Expand Up @@ -387,7 +387,7 @@ changes:
-->

* `command` {string} The command to run.
* `args` {Array} List of string arguments.
* `args` {string[]} List of string arguments.
* `options` {Object}
* `cwd` {string} Current working directory of the child process.
* `env` {Object} Environment key-value pairs.
Expand Down Expand Up @@ -803,7 +803,7 @@ changes:
-->

* `command` {string} The command to run.
* `args` {Array} List of string arguments.
* `args` {string[]} List of string arguments.
* `options` {Object}
* `cwd` {string} Current working directory of the child process.
* `input` {string|Buffer|Uint8Array} The value which will be passed as stdin
Expand Down
4 changes: 2 additions & 2 deletions doc/api/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -713,10 +713,10 @@ changes:
-->

* {Object}
* `execArgv` {Array} List of string arguments passed to the Node.js
* `execArgv` {string[]} List of string arguments passed to the Node.js
executable. **Default:** `process.execArgv`.
* `exec` {string} File path to worker file. **Default:** `process.argv[1]`.
* `args` {Array} String arguments passed to worker.
* `args` {string[]} String arguments passed to worker.
**Default:** `process.argv.slice(2)`.
* `cwd` {string} Current working directory of the worker process. **Default:**
`undefined` (inherits from parent process).
Expand Down
3 changes: 2 additions & 1 deletion doc/api/console.md
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,8 @@ the report to the **Profiles** panel of the inspector. See
added: v8.0.0
-->
* `array` {Array|Object}
* `columns` {Array}
* `columns` {string[]} Display only selected properties of objects in the
`array`.

This method does not display anything unless used in the inspector. Prints to
`stdout` the array `array` formatted as a table.
Expand Down
2 changes: 1 addition & 1 deletion doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -2319,7 +2319,7 @@ changes:
* `path` {string|Buffer|URL}
* `options` {string|Object}
* `encoding` {string} **Default:** `'utf8'`
* Returns: {Array} An array of filenames
* Returns: {string[]} An array of filenames

Synchronous readdir(3). Returns an array of filenames excluding `'.'` and
`'..'`.
Expand Down
8 changes: 4 additions & 4 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -1103,7 +1103,7 @@ const contentType = response.getHeader('content-type');
added: v7.7.0
-->

* Returns: {Array}
* Returns: {string[]}

Returns an array containing the unique names of the current outgoing headers.
All header names are lowercase.
Expand Down Expand Up @@ -1538,7 +1538,7 @@ The request method as a string. Read only. Example:
added: v0.11.6
-->

* {Array}
* {string[]}

The raw request/response headers list exactly as they were received.

Expand Down Expand Up @@ -1567,7 +1567,7 @@ console.log(request.rawHeaders);
added: v0.11.6
-->

* {Array}
* {string[]}

The raw request/response trailer keys and values exactly as they were
received. Only populated at the `'end'` event.
Expand Down Expand Up @@ -1702,7 +1702,7 @@ Url {
added: v0.11.8
-->

* {Array}
* {string[]}

A list of the HTTP methods that are supported by the parser.

Expand Down
6 changes: 3 additions & 3 deletions doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2437,7 +2437,7 @@ The request method as a string. Read-only. Example:
added: v8.4.0
-->

* {Array}
* {string[]}

The raw request/response headers list exactly as they were received.

Expand Down Expand Up @@ -2466,7 +2466,7 @@ console.log(request.rawHeaders);
added: v8.4.0
-->

* {Array}
* {string[]}

The raw request/response trailer keys and values exactly as they were
received. Only populated at the `'end'` event.
Expand Down Expand Up @@ -2710,7 +2710,7 @@ const contentType = response.getHeader('content-type');
added: v8.4.0
-->

* Returns: {Array}
* Returns: {string[]}

Returns an array containing the unique names of the current outgoing headers.
All header names are lowercase.
Expand Down
6 changes: 3 additions & 3 deletions doc/api/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ changes:

* `request` {string} The module path to resolve.
* `options` {Object}
* `paths` {Array} Paths to resolve module location from. If present, these
* `paths` {string[]} Paths to resolve module location from. If present, these
paths are used instead of the default resolution paths. Note that each of
these paths is used as a starting point for the module resolution algorithm,
meaning that the `node_modules` hierarchy is checked from this location.
Expand All @@ -663,7 +663,7 @@ added: v8.9.0
-->

* `request` {string} The module path whose lookup paths are being retrieved.
* Returns: {Array|null}
* Returns: {string[]|null}

Returns an array containing the paths searched during resolution of `request` or
null if the `request` string references a core module, for example `http` or
Expand All @@ -689,7 +689,7 @@ a global but rather local to each module.
added: v0.1.16
-->

* {Array}
* {module[]}

The module objects required by this one.

Expand Down
4 changes: 2 additions & 2 deletions doc/api/os.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ defined are described in [OS Constants](#os_os_constants_1).
added: v0.3.3
-->

* Returns: {Array}
* Returns: {Object[]}

The `os.cpus()` method returns an array of objects containing information about
each logical CPU core.
Expand Down Expand Up @@ -217,7 +217,7 @@ string.
added: v0.3.3
-->

* Returns: {Array}
* Returns: {number[]}

The `os.loadavg()` method returns an array containing the 1, 5, and 15 minute
load averages.
Expand Down
8 changes: 4 additions & 4 deletions doc/api/perf_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ The `PerformanceObserverEntryList` class is used to provide access to the
added: v8.5.0
-->

* Returns: {Array}
* Returns: {PerformanceEntry[]}

Returns a list of `PerformanceEntry` objects in chronological order
with respect to `performanceEntry.startTime`.
Expand All @@ -408,7 +408,7 @@ added: v8.5.0

* `name` {string}
* `type` {string}
* Returns: {Array}
* Returns: {PerformanceEntry[]}

Returns a list of `PerformanceEntry` objects in chronological order
with respect to `performanceEntry.startTime` whose `performanceEntry.name` is
Expand All @@ -421,7 +421,7 @@ added: v8.5.0
-->

* `type` {string}
* Returns: {Array}
* Returns: {PerformanceEntry[]}

Returns a list of `PerformanceEntry` objects in chronological order
with respect to `performanceEntry.startTime` whose `performanceEntry.entryType`
Expand All @@ -438,7 +438,7 @@ Disconnects the `PerformanceObserver` instance from all notifications.
added: v8.5.0
-->
* `options` {Object}
* `entryTypes` {Array} An array of strings identifying the types of
* `entryTypes` {string[]} An array of strings identifying the types of
`PerformanceEntry` instances the observer is interested in. If not
provided an error will be thrown.
* `buffered` {boolean} If true, the notification callback will be
Expand Down
12 changes: 6 additions & 6 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ console.log(`This processor architecture is ${process.arch}`);
added: v0.1.27
-->

* {Array}
* {string[]}

The `process.argv` property returns an array containing the command line
arguments passed when the Node.js process was launched. The first element will
Expand Down Expand Up @@ -923,7 +923,7 @@ console.log(process.env.test);
added: v0.7.7
-->

* {Array}
* {string[]}

The `process.execArgv` property returns the set of Node.js-specific command-line
options passed when the Node.js process was launched. These options do not
Expand Down Expand Up @@ -1106,7 +1106,7 @@ Android).
added: v0.9.4
-->

* Returns: {Array}
* Returns: {integer[]}

The `process.getgroups()` method returns an array with the supplementary group
IDs. POSIX leaves it unspecified if the effective group ID is included but
Expand Down Expand Up @@ -1149,8 +1149,8 @@ Indicates whether a callback has been set using
added: v0.7.6
-->

* `time` {Array} The result of a previous call to `process.hrtime()`
* Returns: {Array}
* `time` {integer[]} The result of a previous call to `process.hrtime()`
* Returns: {integer[]}

The `process.hrtime()` method returns the current high-resolution real time
in a `[seconds, nanoseconds]` tuple Array, where `nanoseconds` is the
Expand Down Expand Up @@ -1633,7 +1633,7 @@ Android).
added: v0.9.4
-->

* `groups` {Array}
* `groups` {integer[]}

The `process.setgroups()` method sets the supplementary group IDs for the
Node.js process. This is a privileged operation that requires the Node.js
Expand Down
2 changes: 1 addition & 1 deletion doc/api/punycode.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ punycode.ucs2.decode('\uD834\uDF06'); // [0x1D306]
added: v0.7.0
-->

* `codePoints` {Array}
* `codePoints` {integer[]}

The `punycode.ucs2.encode()` method returns a string based on an array of
numeric code point values.
Expand Down
2 changes: 1 addition & 1 deletion doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,7 @@ user programs.

#### writable.\_writev(chunks, callback)

* `chunks` {Array} The chunks to be written. Each chunk has following
* `chunks` {Object[]} The chunks to be written. Each chunk has following
format: `{ chunk: ..., encoding: ... }`.
* `callback` {Function} A callback function (optionally with an error
argument) to be invoked when processing is complete for the supplied chunks.
Expand Down
2 changes: 1 addition & 1 deletion doc/api/url.md
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ are no such pairs, `null` is returned.
#### urlSearchParams.getAll(name)

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

Returns the values of all name-value pairs whose name is `name`. If there are
no such pairs, an empty array is returned.
Expand Down
2 changes: 1 addition & 1 deletion doc/api/v8.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ For use inside of a custom [`deserializer._readHostObject()`][].

#### deserializer.readUint64()

* Returns: {Array}
* Returns: {integer[]}

Read a raw 64-bit unsigned integer and return it as an array `[hi, lo]`
with two 32-bit unsigned integer entries.
Expand Down
3 changes: 3 additions & 0 deletions tools/doc/type-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,11 @@ const customTypesMap = {
'net.Server': 'net.html#net_class_net_server',
'net.Socket': 'net.html#net_class_net_socket',

'module': 'modules.html#modules_the_module_object',

'os.constants.dlopen': 'os.html#os_dlopen_constants',

'PerformanceEntry': 'perf_hooks.html#perf_hooks_class_performanceentry',
'PerformanceObserver':
'perf_hooks.html#perf_hooks_class_performanceobserver_callback',
'PerformanceObserverEntryList':
Expand Down