doc: add missing periods or colons

Some other formatting nits were fixed
and some superfluous descriptions were simplified in passing.

PR-URL: https://github.com/nodejs/node/pull/20401
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Vse Mozhet Byt 2018-04-29 14:16:44 +03:00
parent 536b1fbd3f
commit 392d80a617
26 changed files with 97 additions and 100 deletions

View File

@ -2458,7 +2458,7 @@ added: v3.0.0
* {integer} The largest size allowed for a single `Buffer` instance.
An alias for [`buffer.constants.MAX_LENGTH`][]
An alias for [`buffer.constants.MAX_LENGTH`][].
Note that this is a property on the `buffer` module returned by
`require('buffer')`, not on the `Buffer` global or a `Buffer` instance.

View File

@ -652,7 +652,7 @@ child registers an event handler for the [`'disconnect'`][] event
or the [`'message'`][] event. This allows the child to exit
normally without the process being held open by the open IPC channel.*
See also: [`child_process.exec()`][] and [`child_process.fork()`][]
See also: [`child_process.exec()`][] and [`child_process.fork()`][].
## Synchronous Process Creation
@ -776,7 +776,7 @@ process has exited.*
If the process times out or has a non-zero exit code, this method ***will***
throw. The [`Error`][] object will contain the entire result from
[`child_process.spawnSync()`][]
[`child_process.spawnSync()`][].
**Never pass unsanitized user input to this function. Any input containing shell
metacharacters may be used to trigger arbitrary command execution.**
@ -1056,7 +1056,7 @@ does not indicate that the child process has been terminated.
added: v0.1.90
-->
* {number} Integer
* {integer}
Returns the process identifier (PID) of the child process.

View File

@ -58,7 +58,7 @@ added: v6.0.0
-->
Enable FIPS-compliant crypto at startup. (Requires Node.js to be built with
`./configure --openssl-fips`)
`./configure --openssl-fips`.)
### `--experimental-modules`
<!-- YAML
@ -87,14 +87,14 @@ added: v6.0.0
-->
Force FIPS-compliant crypto on startup. (Cannot be disabled from script code.)
(Same requirements as `--enable-fips`)
(Same requirements as `--enable-fips`.)
### `--icu-data-dir=file`
<!-- YAML
added: v0.11.15
-->
Specify ICU data load path. (overrides `NODE_ICU_DATA`)
Specify ICU data load path. (Overrides `NODE_ICU_DATA`.)
### `--inspect-brk[=[host:]port]`
<!-- YAML
@ -246,8 +246,8 @@ Throw errors for deprecations.
added: v4.0.0
-->
Specify an alternative default TLS cipher list. (Requires Node.js to be built
with crypto support. (Default))
Specify an alternative default TLS cipher list. Requires Node.js to be built
with crypto support (default).
### `--trace-deprecation`
<!-- YAML

View File

@ -363,7 +363,7 @@ Each new worker is given its own unique id, this id is stored in the
`id`.
While a worker is alive, this is the key that indexes it in
cluster.workers
`cluster.workers`.
### worker.isConnected()
<!-- YAML
@ -412,7 +412,7 @@ All workers are created using [`child_process.fork()`][], the returned object
from this function is stored as `.process`. In a worker, the global `process`
is stored.
See: [Child Process module][]
See: [Child Process module][].
Note that workers will call `process.exit(0)` if the `'disconnect'` event occurs
on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
@ -748,7 +748,7 @@ changes:
description: The `stdio` option is supported now.
-->
* `settings` {Object} see [`cluster.settings`][]
* `settings` {Object} See [`cluster.settings`][].
`setupMaster` is used to change the default 'fork' behavior. Once called,
the settings will be present in `cluster.settings`.

View File

@ -99,7 +99,7 @@ changes:
Setting to `true` enables coloring while inspecting values, setting to
`'auto'` will make color support depend on the value of the `isTTY` property
and the value returned by `getColorDepth()` on the respective stream.
**Default:** `'auto'`
**Default:** `'auto'`.
Creates a new `Console` with one or two writable stream instances. `stdout` is a
writable stream to print log or info output. `stderr` is used for warning or

View File

@ -170,7 +170,7 @@ explicitly via error event handlers set on the domain instead.
Type: End-of-Life
Calling an asynchronous function without a callback throws a `TypeError`
v10.0.0 onwards. Refer: [PR 12562](https://github.com/nodejs/node/pull/12562)
v10.0.0 onwards. Refer: [PR 12562](https://github.com/nodejs/node/pull/12562).
<a id="DEP0014"></a>
### DEP0014: fs.read legacy String interface

View File

@ -111,7 +111,7 @@ properties.
added: v0.1.99
-->
* `port` {number} Integer.
* `port` {integer}
* `address` {string}
* `callback` {Function} with no parameters. Called when binding is complete.
@ -279,9 +279,9 @@ changes:
-->
* `msg` {Buffer|Uint8Array|string|Array} Message to be sent.
* `offset` {number} Integer. Offset in the buffer where the message starts.
* `length` {number} Integer. Number of bytes in the message.
* `port` {number} Integer. Destination port.
* `offset` {integer} Offset in the buffer where the message starts.
* `length` {integer} Number of bytes in the message.
* `port` {integer} Destination port.
* `address` {string} Destination hostname or IP address.
* `callback` {Function} Called when the message has been sent.
@ -479,7 +479,7 @@ multicast packets will also be received on the local interface.
added: v0.3.8
-->
* `ttl` {number} Integer.
* `ttl` {integer}
Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for
"Time to Live", in this context it specifies the number of IP hops that a
@ -495,7 +495,7 @@ between 0 and 255. The default on most systems is `1` but can vary.
added: v8.7.0
-->
* `size` {number} Integer
* `size` {integer}
Sets the `SO_RCVBUF` socket option. Sets the maximum socket receive buffer
in bytes.
@ -505,7 +505,7 @@ in bytes.
added: v8.7.0
-->
* `size` {number} Integer
* `size` {integer}
Sets the `SO_SNDBUF` socket option. Sets the maximum socket send buffer
in bytes.
@ -515,7 +515,7 @@ in bytes.
added: v0.1.101
-->
* `ttl` {number} Integer.
* `ttl` {integer}
Sets the `IP_TTL` socket option. While TTL generally stands for "Time to Live",
in this context it specifies the number of IP hops that a packet is allowed to

View File

@ -1660,7 +1660,7 @@ entry types were found.
<a id="ERR_VALUE_OUT_OF_RANGE"></a>
### ERR_VALUE_OUT_OF_RANGE
Superseded by `ERR_OUT_OF_RANGE`
Superseded by `ERR_OUT_OF_RANGE`.
<a id="ERR_VM_MODULE_ALREADY_LINKED"></a>
### ERR_VM_MODULE_ALREADY_LINKED

View File

@ -500,7 +500,7 @@ added: v0.1.10
Returns `true` if the `fs.Stats` object describes a symbolic link.
This method is only valid when using [`fs.lstat()`][]
This method is only valid when using [`fs.lstat()`][].
### stats.dev
@ -1038,7 +1038,7 @@ changes:
Asynchronously changes the permissions of a file. No arguments other than a
possible exception are given to the completion callback.
See also: chmod(2)
See also: chmod(2).
### File modes
@ -1097,7 +1097,7 @@ changes:
Synchronously changes the permissions of a file. Returns `undefined`.
This is the synchronous version of [`fs.chmod()`][].
See also: chmod(2)
See also: chmod(2).
## fs.chown(path, uid, gid, callback)
<!-- YAML
@ -1126,7 +1126,7 @@ changes:
Asynchronously changes owner and group of a file. No arguments other than a
possible exception are given to the completion callback.
See also: chown(2)
See also: chown(2).
## fs.chownSync(path, uid, gid)
<!-- YAML
@ -1145,7 +1145,7 @@ changes:
Synchronously changes owner and group of a file. Returns `undefined`.
This is the synchronous version of [`fs.chown()`][].
See also: chown(2)
See also: chown(2).
## fs.close(fd, callback)
<!-- YAML
@ -1711,7 +1711,8 @@ given to the completion callback.
If the file referred to by the file descriptor was larger than `len` bytes, only
the first `len` bytes will be retained in the file.
For example, the following program retains only the first four bytes of the file
For example, the following program retains only the first four bytes of the
file:
```js
console.log(fs.readFileSync('temp.txt', 'utf8'));
@ -1985,7 +1986,7 @@ changes:
Asynchronously creates a directory. No arguments other than a possible exception
are given to the completion callback.
See also: mkdir(2)
See also: mkdir(2).
## fs.mkdirSync(path[, mode])
<!-- YAML
@ -2003,7 +2004,7 @@ changes:
Synchronously creates a directory. Returns `undefined`.
This is the synchronous version of [`fs.mkdir()`][].
See also: mkdir(2)
See also: mkdir(2).
## fs.mkdtemp(prefix[, options], callback)
<!-- YAML
@ -2868,7 +2869,7 @@ fs.unlink('path/file.txt', (err) => {
`fs.unlink()` will not work on a directory, empty or otherwise. To remove a
directory, use [`fs.rmdir()`][].
See also: unlink(2)
See also: unlink(2).
## fs.unlinkSync(path)
<!-- YAML

View File

@ -459,7 +459,7 @@ added: v0.7.8
Emitted when the underlying socket times out from inactivity. This only notifies
that the socket has been idle. The request must be aborted manually.
See also: [`request.setTimeout()`][]
See also: [`request.setTimeout()`][].
### Event: 'upgrade'
<!-- YAML
@ -541,7 +541,7 @@ added: v0.3.0
* {net.Socket}
See [`request.socket`][]
See [`request.socket`][].
### request.end([data[, encoding]][, callback])
<!-- YAML
@ -1798,7 +1798,7 @@ automatically. Note that the callback must take care to consume the response
data for reasons stated in [`http.ClientRequest`][] section.
The `callback` is invoked with a single argument that is an instance of
[`http.IncomingMessage`][]
[`http.IncomingMessage`][].
JSON Fetching Example:

View File

@ -642,7 +642,7 @@ protocol is available on the host `'example.org'` on TCP/IP port 81. The
host and port *must* be contained within the quote (`"`) characters.
Multiple alternatives may be specified, for instance: `'h2="example.org:81",
h2=":82"'`
h2=":82"'`.
The protocol identifier (`'h2'` in the examples) may be any valid
[ALPN Protocol ID][].

View File

@ -170,7 +170,7 @@ Makes a request to a secure web server.
The following additional `options` from [`tls.connect()`][] are also accepted:
`ca`, `cert`, `ciphers`, `clientCertEngine`, `crl`, `dhparam`, `ecdhCurve`,
`honorCipherOrder`, `key`, `passphrase`, `pfx`, `rejectUnauthorized`,
`secureOptions`, `secureProtocol`, `servername`, `sessionIdContext`
`secureOptions`, `secureProtocol`, `servername`, `sessionIdContext`.
`options` can be an object, a string, or a [`URL`][] object. If `options` is a
string, it is automatically parsed with [`new URL()`][]. If it is a [`URL`][]

View File

@ -706,7 +706,7 @@ this, assign the desired export object to `module.exports`. Note that assigning
the desired object to `exports` will simply rebind the local `exports` variable,
which is probably not what is desired.
For example suppose we were making a module called `a.js`
For example suppose we were making a module called `a.js`:
```js
const EventEmitter = require('events');
@ -720,7 +720,7 @@ setTimeout(() => {
}, 1000);
```
Then in another file we could do
Then in another file we could do:
```js
const a = require('./a');

View File

@ -2635,7 +2635,7 @@ napi_status napi_set_named_property(napi_env env,
Returns `napi_ok` if the API succeeded.
This method is equivalent to calling [`napi_set_property`][] with a `napi_value`
created from the string passed in as `utf8Name`
created from the string passed in as `utf8Name`.
#### napi_get_named_property
<!-- YAML
@ -2656,7 +2656,7 @@ napi_status napi_get_named_property(napi_env env,
Returns `napi_ok` if the API succeeded.
This method is equivalent to calling [`napi_get_property`][] with a `napi_value`
created from the string passed in as `utf8Name`
created from the string passed in as `utf8Name`.
#### napi_has_named_property
<!-- YAML
@ -2677,7 +2677,7 @@ napi_status napi_has_named_property(napi_env env,
Returns `napi_ok` if the API succeeded.
This method is equivalent to calling [`napi_has_property`][] with a `napi_value`
created from the string passed in as `utf8Name`
created from the string passed in as `utf8Name`.
#### napi_set_element
<!-- YAML

View File

@ -114,11 +114,10 @@ added: v0.1.90
* Returns: {Object}
Returns the bound address, the address family name, and port of the server
as reported by the operating system if listening on an IP socket.
Useful to find which port was assigned when getting an OS-assigned address.
Returns an object with `port`, `family`, and `address` properties:
`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`
Returns the bound `address`, the address `family` name, and `port` of the server
as reported by the operating system if listening on an IP socket
(useful to find which port was assigned when getting an OS-assigned address):
`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`.
For a server listening on a pipe or UNIX domain socket, the name is returned
as a string.
@ -442,7 +441,7 @@ added: v0.1.90
Emitted when the write buffer becomes empty. Can be used to throttle uploads.
See also: the return values of `socket.write()`
See also: the return values of `socket.write()`.
### Event: 'end'
<!-- YAML
@ -504,7 +503,7 @@ added: v0.1.90
Emitted if the socket times out from inactivity. This is only to notify that
the socket has been idle. The user must manually close the connection.
See also: [`socket.setTimeout()`][]
See also: [`socket.setTimeout()`][].
### socket.address()
<!-- YAML
@ -513,9 +512,8 @@ added: v0.1.90
* Returns: {Object}
Returns the bound address, the address family name and port of the
socket as reported by the operating system. Returns an object with
three properties, e.g.
Returns the bound `address`, the address `family` name and `port` of the
socket as reported by the operating system:
`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`
### socket.bufferSize
@ -954,7 +952,7 @@ client.on('end', () => {
```
To connect on the socket `/tmp/echo.sock` the second line would just be
changed to
changed to:
```js
const client = net.createConnection({ path: '/tmp/echo.sock' });
@ -1064,7 +1062,7 @@ $ telnet localhost 8124
```
To listen on the socket `/tmp/echo.sock` the third line from the last would
just be changed to
just be changed to:
```js
server.listen('/tmp/echo.sock', () => {

View File

@ -254,7 +254,7 @@ The properties available on the assigned network address object include:
is `IPv6`)
* `cidr` {string} The assigned IPv4 or IPv6 address with the routing prefix
in CIDR notation. If the `netmask` is invalid, this property is set
to `null`
to `null`.
<!-- eslint-skip -->
```js

View File

@ -289,7 +289,7 @@ command-line option can be used to suppress the default console output but the
`'warning'` event will still be emitted by the `process` object.
The following example illustrates the warning that is printed to `stderr` when
too many listeners have been added to an event
too many listeners have been added to an event:
```txt
$ node

View File

@ -90,7 +90,7 @@ The `'pause'` event is emitted when one of the following occur:
* The `input` stream is paused.
* The `input` stream is not paused and receives the `'SIGCONT'` event. (See
events [`'SIGTSTP'`][] and [`'SIGCONT'`][])
events [`'SIGTSTP'`][] and [`'SIGCONT'`][].)
The listener function is called without passing any arguments.

View File

@ -40,7 +40,7 @@ The following special commands are supported by all REPL instances:
`> .save ./file/to/save.js`
* `.load` - Load a file into the current REPL session.
`> .load ./file/to/load.js`
* `.editor` - Enter editor mode (`<ctrl>-D` to finish, `<ctrl>-C` to cancel)
* `.editor` - Enter editor mode (`<ctrl>-D` to finish, `<ctrl>-C` to cancel).
<!-- eslint-skip -->
```js
@ -607,10 +607,11 @@ By starting a REPL from a Unix socket-based server instead of stdin, it is
possible to connect to a long-running Node.js process without restarting it.
For an example of running a "full-featured" (`terminal`) REPL over
a `net.Server` and `net.Socket` instance, see: https://gist.github.com/2209310
a `net.Server` and `net.Socket` instance, see:
[https://gist.github.com/2209310](https://gist.github.com/2209310).
For an example of running a REPL instance over [curl(1)][],
see: https://gist.github.com/2053342
For an example of running a REPL instance over [curl(1)][], see:
[https://gist.github.com/2053342](https://gist.github.com/2053342).
[`--experimental-repl-await`]: cli.html#cli_experimental_repl_await
[`readline.InterfaceCompleter`]: readline.html#readline_use_of_the_completer_function

View File

@ -2407,14 +2407,12 @@ The workaround in this situation is to call the
```js
// Workaround
net.createServer((socket) => {
socket.on('end', () => {
socket.end('The message was received but was not processed.\n');
});
// start the flow of data, discarding it.
socket.resume();
}).listen(1337);
```

View File

@ -88,9 +88,9 @@ $ node hello-world.js
An output like this should appear in the terminal to indicate Node.js
server is running:
```console
Server running at http://127.0.0.1:3000/
````
```console
Server running at http://127.0.0.1:3000/
```
Now, open any preferred web browser and visit `http://127.0.0.1:3000`.

View File

@ -404,7 +404,7 @@ added: v3.0.0
* Returns: {Buffer}
Returns a `Buffer` instance holding the keys currently used for
encryption/decryption of the [TLS Session Tickets][]
encryption/decryption of the [TLS Session Tickets][].
### server.listen()
@ -516,10 +516,9 @@ added: v0.11.4
* Returns: {Object}
Returns the bound address, the address family name, and port of the
underlying socket as reported by the operating system. Returns an
object with three properties, e.g.
`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`
Returns the bound `address`, the address `family` name, and `port` of the
underlying socket as reported by the operating system:
`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`.
### tlsSocket.authorizationError
<!-- YAML
@ -565,7 +564,7 @@ added: v0.11.4
Returns an object representing the cipher name. The `version` key is a legacy
field which always contains the value `'TLSv1/SSLv3'`.
For example: `{ name: 'AES256-SHA', version: 'TLSv1/SSLv3' }`
For example: `{ name: 'AES256-SHA', version: 'TLSv1/SSLv3' }`.
See `SSL_CIPHER_get_name()` in
https://www.openssl.org/docs/man1.1.0/ssl/SSL_CIPHER_get_name.html for more
@ -585,7 +584,7 @@ ephemeral. As this is only supported on a client socket; `null` is returned
if called on a server socket. The supported types are `'DH'` and `'ECDH'`. The
`name` property is available only when type is 'ECDH'.
For Example: `{ type: 'ECDH', name: 'prime256v1', size: 256 }`
For example: `{ type: 'ECDH', name: 'prime256v1', size: 256 }`.
### tlsSocket.getFinished()
<!-- YAML
@ -1216,7 +1215,6 @@ const options = {
// This is necessary only if using the client certificate authentication.
requestCert: true,
};
const server = tls.createServer(options, (socket) => {
@ -1341,7 +1339,7 @@ changes:
* `session` {Buffer} An optional `Buffer` instance containing a TLS session.
* `requestOCSP` {boolean} If `true`, specifies that the OCSP status request
extension will be added to the client hello and an `'OCSPResponse'` event
will be emitted on the socket before establishing a secure communication
will be emitted on the socket before establishing a secure communication.
Creates a new secure pair object with two streams, one of which reads and writes
the encrypted data and the other of which reads and writes the cleartext data.

View File

@ -884,42 +884,42 @@ double slashes (if present) and precedes the `host` component, delimited by an
ASCII "at sign" (`@`). The format of the string is `{username}[:{password}]`,
with the `[:{password}]` portion being optional.
For example: `'user:pass'`
For example: `'user:pass'`.
#### urlObject.hash
The `hash` property consists of the "fragment" portion of the URL including
the leading ASCII hash (`#`) character.
For example: `'#hash'`
For example: `'#hash'`.
#### urlObject.host
The `host` property is the full lower-cased host portion of the URL, including
the `port` if specified.
For example: `'sub.host.com:8080'`
For example: `'sub.host.com:8080'`.
#### urlObject.hostname
The `hostname` property is the lower-cased host name portion of the `host`
component *without* the `port` included.
For example: `'sub.host.com'`
For example: `'sub.host.com'`.
#### urlObject.href
The `href` property is the full URL string that was parsed with both the
`protocol` and `host` components converted to lower-case.
For example: `'http://user:pass@sub.host.com:8080/p/a/t/h?query=string#hash'`
For example: `'http://user:pass@sub.host.com:8080/p/a/t/h?query=string#hash'`.
#### urlObject.path
The `path` property is a concatenation of the `pathname` and `search`
components.
For example: `'/p/a/t/h?query=string'`
For example: `'/p/a/t/h?query=string'`.
No decoding of the `path` is performed.
@ -930,7 +930,7 @@ is everything following the `host` (including the `port`) and before the start
of the `query` or `hash` components, delimited by either the ASCII question
mark (`?`) or hash (`#`) characters.
For example `'/p/a/t/h'`
For example `'/p/a/t/h'`.
No decoding of the path string is performed.
@ -938,13 +938,13 @@ No decoding of the path string is performed.
The `port` property is the numeric port portion of the `host` component.
For example: `'8080'`
For example: `'8080'`.
#### urlObject.protocol
The `protocol` property identifies the URL's lower-cased protocol scheme.
For example: `'http:'`
For example: `'http:'`.
#### urlObject.query
@ -953,7 +953,7 @@ question mark (`?`), or an object returned by the [`querystring`][] module's
`parse()` method. Whether the `query` property is a string or object is
determined by the `parseQueryString` argument passed to `url.parse()`.
For example: `'query=string'` or `{'query': 'string'}`
For example: `'query=string'` or `{'query': 'string'}`.
If returned as a string, no decoding of the query string is performed. If
returned as an object, both keys and values are decoded.
@ -963,7 +963,7 @@ returned as an object, both keys and values are decoded.
The `search` property consists of the entire "query string" portion of the
URL, including the leading ASCII question mark (`?`) character.
For example: `'?query=string'`
For example: `'?query=string'`.
No decoding of the query string is performed.

View File

@ -54,18 +54,19 @@ Since `null` has a special meaning as the first argument to a callback, if a
wrapped function rejects a `Promise` with a falsy value as a reason, the value
is wrapped in an `Error` with the original value stored in a field named
`reason`.
```js
function fn() {
return Promise.reject(null);
}
const callbackFunction = util.callbackify(fn);
callbackFunction((err, ret) => {
// When the Promise was rejected with `null` it is wrapped with an Error and
// the original value is stored in `reason`.
err && err.hasOwnProperty('reason') && err.reason === null; // true
});
```
```js
function fn() {
return Promise.reject(null);
}
const callbackFunction = util.callbackify(fn);
callbackFunction((err, ret) => {
// When the Promise was rejected with `null` it is wrapped with an Error and
// the original value is stored in `reason`.
err && err.hasOwnProperty('reason') && err.reason === null; // true
});
```
## util.debuglog(section)
<!-- YAML
@ -339,7 +340,7 @@ stream.on('data', (data) => {
stream.write('It works!'); // Received data: "It works!"
```
ES6 example using `class` and `extends`
ES6 example using `class` and `extends`:
```js
const EventEmitter = require('events');

View File

@ -867,7 +867,7 @@ const code = `
})`;
vm.runInThisContext(code)(require);
```
```
The `require()` in the above case shares the state with the context it is
passed from. This may introduce risks when untrusted code is executed, e.g.

View File

@ -312,7 +312,7 @@ ignored by the decompression classes.
* `strategy` {integer} (compression only)
* `dictionary` {Buffer|TypedArray|DataView|ArrayBuffer} (deflate/inflate only,
empty dictionary by default)
* `info` {boolean} (If `true`, returns an object with `buffer` and `engine`)
* `info` {boolean} (If `true`, returns an object with `buffer` and `engine`.)
See the description of `deflateInit2` and `inflateInit2` at
<https://zlib.net/manual.html#Advanced> for more information on these.