From 2ae9cd7bf9f1f3a60ac7c2904dfb2f2e3d93599e Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Mon, 9 Apr 2018 15:25:04 +0300 Subject: [PATCH] doc: specify definite Array types Replace `{Array}` with `{type[]}`. --- doc/api/buffer.md | 5 +++-- doc/api/child_process.md | 8 ++++---- doc/api/cluster.md | 4 ++-- doc/api/console.md | 3 ++- doc/api/fs.md | 2 +- doc/api/http.md | 8 ++++---- doc/api/http2.md | 6 +++--- doc/api/modules.md | 6 +++--- doc/api/os.md | 4 ++-- doc/api/perf_hooks.md | 8 ++++---- doc/api/process.md | 12 ++++++------ doc/api/punycode.md | 2 +- doc/api/stream.md | 2 +- doc/api/url.md | 2 +- doc/api/v8.md | 2 +- tools/doc/type-parser.js | 3 +++ 16 files changed, 41 insertions(+), 36 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 4821a531a9af0a..b6db1032ad36db 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -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} @@ -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. diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 7921a88c3d937d..1ebd3cee199e4a 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -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 @@ -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. @@ -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 diff --git a/doc/api/cluster.md b/doc/api/cluster.md index 7385e9ba78bd81..5f5273d37301c4 100644 --- a/doc/api/cluster.md +++ b/doc/api/cluster.md @@ -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). diff --git a/doc/api/console.md b/doc/api/console.md index 9bbcae0cfd51cc..53395d8ef6f2d6 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -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. diff --git a/doc/api/fs.md b/doc/api/fs.md index 1028b2f42af5af..562c80812b28c6 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -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 `'..'`. diff --git a/doc/api/http.md b/doc/api/http.md index 4218bbf7e6ed10..6a9e66cb5aafcb 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -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. @@ -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. @@ -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. @@ -1702,7 +1702,7 @@ Url { added: v0.11.8 --> -* {Array} +* {string[]} A list of the HTTP methods that are supported by the parser. diff --git a/doc/api/http2.md b/doc/api/http2.md index 61f52d41d3f660..ef0fc85d774d48 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -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. @@ -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. @@ -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. diff --git a/doc/api/modules.md b/doc/api/modules.md index 277dff8f6b6fb9..b1656fcd272ea7 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -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. @@ -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 @@ -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. diff --git a/doc/api/os.md b/doc/api/os.md index 9210abcb51c679..aa074ce00179bf 100644 --- a/doc/api/os.md +++ b/doc/api/os.md @@ -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. @@ -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. diff --git a/doc/api/perf_hooks.md b/doc/api/perf_hooks.md index 465b594cb0e8f5..a3c3b2eb365efc 100644 --- a/doc/api/perf_hooks.md +++ b/doc/api/perf_hooks.md @@ -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`. @@ -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 @@ -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` @@ -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 diff --git a/doc/api/process.md b/doc/api/process.md index 6338da49aa5229..2fafda5dec979f 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/doc/api/punycode.md b/doc/api/punycode.md index 01df2809d5165d..3f5b9746c1995d 100644 --- a/doc/api/punycode.md +++ b/doc/api/punycode.md @@ -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. diff --git a/doc/api/stream.md b/doc/api/stream.md index 86286906b7f297..8ad93c09d1a833 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -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. diff --git a/doc/api/url.md b/doc/api/url.md index 62d19d9c90d7b0..183631e64e078b 100644 --- a/doc/api/url.md +++ b/doc/api/url.md @@ -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. diff --git a/doc/api/v8.md b/doc/api/v8.md index a72d7fa51e4d3a..9f9ad8ae5162da 100644 --- a/doc/api/v8.md +++ b/doc/api/v8.md @@ -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. diff --git a/tools/doc/type-parser.js b/tools/doc/type-parser.js index 5386039b36709f..84a87498762930 100644 --- a/tools/doc/type-parser.js +++ b/tools/doc/type-parser.js @@ -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':