Skip to content

Commit 4d67369

Browse files
vsemozhetbytMylesBorins
authored andcommitted
doc: fix various nits
* Replace 2 hyphens (--) by spaced m-dashes (—) as per STYLE_GUIDE.md. * Space infix operators. * Unify quotes in inline code spans (use only single quotes). * Unify `* Returns:` (eliminate deviations). * Dedupe spaces. Backport-PR-URL: #19761 PR-URL: #19743 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 18acad3 commit 4d67369

30 files changed

+228
-227
lines changed

doc/api/addons.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Addon module name is `addon`.
101101
Once the source code has been written, it must be compiled into the binary
102102
`addon.node` file. To do so, create a file called `binding.gyp` in the
103103
top-level of the project describing the build configuration of your module
104-
using a JSON-like format. This file is used by [node-gyp][] -- a tool written
104+
using a JSON-like format. This file is used by [node-gyp][] a tool written
105105
specifically to compile Node.js Addons.
106106

107107
```json

doc/api/buffer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ deprecated: v6.0.0
395395
396396
* `size` {integer} The desired length of the new `Buffer`.
397397

398-
Allocates a new `Buffer` of `size` bytes. The `size` must be less than or equal
398+
Allocates a new `Buffer` of `size` bytes. The `size` must be less than or equal
399399
to the value of [`buffer.kMaxLength`]. Otherwise, a [`RangeError`] is thrown.
400400
A zero-length `Buffer` will be created if `size <= 0`.
401401

doc/api/child_process.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ the event loop until the spawned process either exits or is terminated.
3838

3939
For convenience, the `child_process` module provides a handful of synchronous
4040
and asynchronous alternatives to [`child_process.spawn()`][] and
41-
[`child_process.spawnSync()`][]. *Note that each of these alternatives are
41+
[`child_process.spawnSync()`][]. *Note that each of these alternatives are
4242
implemented on top of [`child_process.spawn()`][] or [`child_process.spawnSync()`][].*
4343

4444
* [`child_process.exec()`][]: spawns a shell and runs a command within that shell,
@@ -140,7 +140,8 @@ added: v0.1.90
140140
command line parsing should be compatible with `cmd.exe`.
141141
* `timeout` {number} **Default:** `0`
142142
* [`maxBuffer`][] {number} Largest amount of data (in bytes) allowed on
143-
stdout or stderr - if exceeded child process is killed. **Default:** `200*1024`
143+
stdout or stderr - if exceeded child process is killed.
144+
**Default:** `200 * 1024`.
144145
* `killSignal` {string|integer} **Default:** `'SIGTERM'`
145146
* `uid` {number} Sets the user identity of the process (see setuid(2)).
146147
* `gid` {number} Sets the group identity of the process (see setgid(2)).
@@ -170,7 +171,7 @@ exec('cat *.js bad_file | wc -l', (error, stdout, stderr) => {
170171
```
171172

172173
If a `callback` function is provided, it is called with the arguments
173-
`(error, stdout, stderr)`. On success, `error` will be `null`. On error,
174+
`(error, stdout, stderr)`. On success, `error` will be `null`. On error,
174175
`error` will be an instance of [`Error`][]. The `error.code` property will be
175176
the exit code of the child process while `error.signal` will be set to the
176177
signal that terminated the process. Any exit code other than `0` is considered
@@ -218,7 +219,7 @@ added: v0.1.91
218219
* `timeout` {number} **Default:** `0`
219220
* [`maxBuffer`][] {number} Largest amount of data (in bytes) allowed on
220221
stdout or stderr - if exceeded child process is killed.
221-
**Default:**: `200*1024`
222+
**Default:** `200 * 1024`.
222223
* `killSignal` {string|integer} **Default:** `'SIGTERM'`
223224
* `uid` {number} Sets the user identity of the process (see setuid(2)).
224225
* `gid` {number} Sets the group identity of the process (see setgid(2)).
@@ -446,7 +447,7 @@ disabled*.
446447
On non-Windows platforms, if `options.detached` is set to `true`, the child
447448
process will be made the leader of a new process group and session. Note that
448449
child processes may continue running after the parent exits regardless of
449-
whether they are detached or not. See setsid(2) for more information.
450+
whether they are detached or not. See setsid(2) for more information.
450451

451452
By default, the parent will wait for the detached child to exit. To prevent
452453
the parent from waiting for a given `subprocess`, use the `subprocess.unref()`
@@ -656,12 +657,12 @@ The `child_process.execSync()` method is generally identical to
656657
[`child_process.exec()`][] with the exception that the method will not return until
657658
the child process has fully closed. When a timeout has been encountered and
658659
`killSignal` is sent, the method won't return until the process has completely
659-
exited. *Note that if the child process intercepts and handles the `SIGTERM`
660+
exited. *Note that if the child process intercepts and handles the `SIGTERM`
660661
signal and doesn't exit, the parent process will wait until the child
661662
process has exited.*
662663

663664
If the process times out, or has a non-zero exit code, this method ***will***
664-
throw. The [`Error`][] object will contain the entire result from
665+
throw. The [`Error`][] object will contain the entire result from
665666
[`child_process.spawnSync()`][]
666667

667668
**Note: Never pass unsanitised user input to this function. Any input
@@ -997,7 +998,7 @@ properties:
997998
Defaults to `false`.
998999

9991000
The optional `callback` is a function that is invoked after the message is
1000-
sent but before the child may have received it. The function is called with a
1001+
sent but before the child may have received it. The function is called with a
10011002
single argument: `null` on success, or an [`Error`][] object on failure.
10021003

10031004
If no `callback` function is provided and the message cannot be sent, an

doc/api/cli.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ added: v6.12.0
342342
-->
343343

344344
`options...` are interpreted as if they had been specified on the command line
345-
before the actual command line (so they can be overriden). Node will exit with
345+
before the actual command line (so they can be overriden). Node will exit with
346346
an error if an option that is not allowed in the environment is used, such as
347347
`-p` or a script file.
348348

@@ -382,7 +382,7 @@ added: v3.0.0
382382

383383
Path to the file used to store the persistent REPL history. The default path is
384384
`~/.node_repl_history`, which is overridden by this variable. Setting the value
385-
to an empty string (`""` or `" "`) disables persistent REPL history.
385+
to an empty string (`''` or `' '`) disables persistent REPL history.
386386

387387

388388
### `NODE_TTY_UNSAFE_ASYNC=1`

doc/api/cluster.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,26 +90,26 @@ Node.js process and a cluster worker differs:
9090
idea of what the number 7 file descriptor references.
9191
2. `server.listen(handle)` Listening on handles explicitly will cause
9292
the worker to use the supplied handle, rather than talk to the master
93-
process. If the worker already has the handle, then it's presumed
93+
process. If the worker already has the handle, then it's presumed
9494
that you know what you are doing.
9595
3. `server.listen(0)` Normally, this will cause servers to listen on a
96-
random port. However, in a cluster, each worker will receive the
97-
same "random" port each time they do `listen(0)`. In essence, the
98-
port is random the first time, but predictable thereafter. If you
96+
random port. However, in a cluster, each worker will receive the
97+
same "random" port each time they do `listen(0)`. In essence, the
98+
port is random the first time, but predictable thereafter. If you
9999
want to listen on a unique port, generate a port number based on the
100100
cluster worker ID.
101101

102102
There is no routing logic in Node.js, or in your program, and no shared
103-
state between the workers. Therefore, it is important to design your
103+
state between the workers. Therefore, it is important to design your
104104
program such that it does not rely too heavily on in-memory data objects
105105
for things like sessions and login.
106106

107107
Because workers are all separate processes, they can be killed or
108108
re-spawned depending on your program's needs, without affecting other
109-
workers. As long as there are some workers still alive, the server will
110-
continue to accept connections. If no workers are alive, existing connections
111-
will be dropped and new connections will be refused. Node.js does not
112-
automatically manage the number of workers for you, however. It is your
109+
workers. As long as there are some workers still alive, the server will
110+
continue to accept connections. If no workers are alive, existing connections
111+
will be dropped and new connections will be refused. Node.js does not
112+
automatically manage the number of workers for you, however. It is your
113113
responsibility to manage the worker pool for your application's needs.
114114

115115
Although a primary use case for the `cluster` module is networking, it can
@@ -489,7 +489,7 @@ Emitted after the worker IPC channel has disconnected. This can occur when a
489489
worker exits gracefully, is killed, or is disconnected manually (such as with
490490
worker.disconnect()).
491491

492-
There may be a delay between the `'disconnect'` and `'exit'` events. These events
492+
There may be a delay between the `'disconnect'` and `'exit'` events. These events
493493
can be used to detect if the process is stuck in a cleanup or if there are
494494
long-living connections.
495495

@@ -582,7 +582,7 @@ The `addressType` is one of:
582582
* `4` (TCPv4)
583583
* `6` (TCPv6)
584584
* `-1` (unix domain socket)
585-
* `"udp4"` or `"udp6"` (UDP v4 or v6)
585+
* `'udp4'` or `'udp6'` (UDP v4 or v6)
586586

587587
## Event: 'message'
588588

@@ -709,7 +709,7 @@ distribute IOCP handles without incurring a large performance hit.
709709

710710
`cluster.schedulingPolicy` can also be set through the
711711
`NODE_CLUSTER_SCHED_POLICY` environment variable. Valid
712-
values are `"rr"` and `"none"`.
712+
values are `'rr'` and `'none'`.
713713

714714
## cluster.settings
715715
<!-- YAML

doc/api/console.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The module exports two specific components:
1212
* A `Console` class with methods such as `console.log()`, `console.error()` and
1313
`console.warn()` that can be used to write to any Node.js stream.
1414
* A global `console` instance configured to write to [`process.stdout`][] and
15-
[`process.stderr`][]. The global `console` can be used without calling
15+
[`process.stderr`][]. The global `console` can be used without calling
1616
`require('console')`.
1717

1818
***Warning***: The global console object's methods are neither consistently

doc/api/crypto.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ added: v0.5.0
452452
-->
453453

454454
Returns the Diffie-Hellman generator in the specified `encoding`, which can
455-
be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is
455+
be `'latin1'`, `'hex'`, or `'base64'`. If `encoding` is provided a string is
456456
returned; otherwise a [`Buffer`][] is returned.
457457

458458
### diffieHellman.getPrime([encoding])

doc/api/debugger.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ debug> repl
6868
Press Ctrl + C to leave debug repl
6969
> x
7070
5
71-
> 2+2
71+
> 2 + 2
7272
4
7373
debug> next
7474
break in /home/indutny/Code/git/indutny/myscript.js:5

doc/api/dns.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ will contain an array of IPv4 addresses (e.g.
212212
* `options` {Object}
213213
* `ttl` {boolean} Retrieve the Time-To-Live value (TTL) of each record.
214214
The callback receives an array of `{ address: '1.2.3.4', ttl: 60 }` objects
215-
rather than an array of strings. The TTL is expressed in seconds.
215+
rather than an array of strings. The TTL is expressed in seconds.
216216
* `callback` {Function} An `(err, result)` callback function.
217217

218218
## dns.resolve6(hostname[, options], callback)
@@ -228,7 +228,7 @@ will contain an array of IPv6 addresses.
228228
* `options` {Object}
229229
* `ttl` {boolean} Retrieve the Time-To-Live value (TTL) of each record.
230230
The callback receives an array of `{ address: '0:1:2:3:4:5:6:7', ttl: 60 }`
231-
objects rather than an array of strings. The TTL is expressed in seconds.
231+
objects rather than an array of strings. The TTL is expressed in seconds.
232232
* `callback` {Function} An `(err, result)` callback function.
233233

234234
## dns.resolveCname(hostname, callback)
@@ -258,7 +258,7 @@ added: v0.9.12
258258

259259
Uses the DNS protocol to resolve regular expression based records (`NAPTR`
260260
records) for the `hostname`. The `callback` function has arguments
261-
`(err, addresses)`. The `addresses` argument passed to the `callback` function
261+
`(err, addresses)`. The `addresses` argument passed to the `callback` function
262262
will contain an array of objects with the following properties:
263263

264264
* `flags`

doc/api/documentation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ using the `tools/doc/generate.js` program. An HTML template is located at
2626
<!--type=misc-->
2727

2828
Throughout the documentation, you will see indications of a section's
29-
stability. The Node.js API is still somewhat changing, and as it
30-
matures, certain parts are more reliable than others. Some are so
29+
stability. The Node.js API is still somewhat changing, and as it
30+
matures, certain parts are more reliable than others. Some are so
3131
proven, and so relied upon, that they are unlikely to ever change at
32-
all. Others are brand new and experimental, or known to be hazardous
32+
all. Others are brand new and experimental, or known to be hazardous
3333
and in the process of being redesigned.
3434

3535
The stability indices are as follows:

doc/api/domain.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ but should expect to have to migrate to a different solution
1212
in the future.
1313

1414
Domains provide a way to handle multiple different IO operations as a
15-
single group. If any of the event emitters or callbacks registered to a
15+
single group. If any of the event emitters or callbacks registered to a
1616
domain emit an `'error'` event, or throw an error, then the domain object
1717
will be notified, rather than losing the context of the error in the
1818
`process.on('uncaughtException')` handler, or causing the program to
@@ -30,7 +30,7 @@ never any way to safely "pick up where you left off", without leaking
3030
references, or creating some other sort of undefined brittle state.
3131

3232
The safest way to respond to a thrown error is to shut down the
33-
process. Of course, in a normal web server, you might have many
33+
process. Of course, in a normal web server, you might have many
3434
connections open, and it is not reasonable to abruptly shut those down
3535
because an error was triggered by someone else.
3636

@@ -40,7 +40,7 @@ time, and stop listening for new requests in that worker.
4040

4141
In this way, `domain` usage goes hand-in-hand with the cluster module,
4242
since the master process can fork a new worker when a worker
43-
encounters an error. For Node.js programs that scale to multiple
43+
encounters an error. For Node.js programs that scale to multiple
4444
machines, the terminating proxy or service registry can take note of
4545
the failure, and react accordingly.
4646

@@ -103,7 +103,7 @@ if (cluster.isMaster) {
103103
const domain = require('domain');
104104

105105
// See the cluster documentation for more details about using
106-
// worker processes to serve requests. How it works, caveats, etc.
106+
// worker processes to serve requests. How it works, caveats, etc.
107107

108108
const server = require('http').createServer((req, res) => {
109109
const d = domain.create();
@@ -126,7 +126,7 @@ if (cluster.isMaster) {
126126
// stop taking new requests.
127127
server.close();
128128

129-
// Let the master know we're dead. This will trigger a
129+
// Let the master know we're dead. This will trigger a
130130
// 'disconnect' in the cluster master, and then it will fork
131131
// a new worker.
132132
cluster.worker.disconnect();
@@ -155,7 +155,7 @@ if (cluster.isMaster) {
155155
server.listen(PORT);
156156
}
157157

158-
// This part is not important. Just an example routing thing.
158+
// This part is not important. Just an example routing thing.
159159
// You'd put your fancy application logic here.
160160
function handleRequest(req, res) {
161161
switch (req.url) {
@@ -197,11 +197,11 @@ the active domain at the time of their creation.
197197

198198
Additionally, callbacks passed to lowlevel event loop requests (such as
199199
to fs.open, or other callback-taking methods) will automatically be
200-
bound to the active domain. If they throw, then the domain will catch
200+
bound to the active domain. If they throw, then the domain will catch
201201
the error.
202202

203203
In order to prevent excessive memory usage, Domain objects themselves
204-
are not implicitly added as children of the active domain. If they
204+
are not implicitly added as children of the active domain. If they
205205
were, then it would be too easy to prevent request and response objects
206206
from being properly garbage collected.
207207

@@ -218,7 +218,7 @@ Implicit binding only takes care of thrown errors and `'error'` events.
218218
<!--type=misc-->
219219

220220
Sometimes, the domain in use is not the one that ought to be used for a
221-
specific event emitter. Or, the event emitter could have been created
221+
specific event emitter. Or, the event emitter could have been created
222222
in the context of one domain, but ought to instead be bound to some
223223
other domain.
224224

@@ -268,7 +268,7 @@ Returns a new Domain object.
268268
The Domain class encapsulates the functionality of routing errors and
269269
uncaught exceptions to the active Domain object.
270270

271-
Domain is a child class of [`EventEmitter`][]. To handle the errors that it
271+
Domain is a child class of [`EventEmitter`][]. To handle the errors that it
272272
catches, listen to its `'error'` event.
273273

274274
### domain.run(fn[, ...args])
@@ -318,13 +318,13 @@ to the domain.
318318

319319
* `emitter` {EventEmitter|Timer} emitter or timer to be added to the domain
320320

321-
Explicitly adds an emitter to the domain. If any event handlers called by
321+
Explicitly adds an emitter to the domain. If any event handlers called by
322322
the emitter throw an error, or if the emitter emits an `'error'` event, it
323323
will be routed to the domain's `'error'` event, just like with implicit
324324
binding.
325325

326326
This also works with timers that are returned from [`setInterval()`][] and
327-
[`setTimeout()`][]. If their callback function throws, it will be caught by
327+
[`setTimeout()`][]. If their callback function throws, it will be caught by
328328
the domain 'error' handler.
329329

330330
If the Timer or EventEmitter was already bound to a domain, it is removed
@@ -334,7 +334,7 @@ from that one, and bound to this one instead.
334334

335335
* `emitter` {EventEmitter|Timer} emitter or timer to be removed from the domain
336336

337-
The opposite of [`domain.add(emitter)`][]. Removes domain handling from the
337+
The opposite of [`domain.add(emitter)`][]. Removes domain handling from the
338338
specified emitter.
339339

340340
### domain.bind(callback)
@@ -343,7 +343,7 @@ specified emitter.
343343
* Returns: {Function} The bound function
344344

345345
The returned function will be a wrapper around the supplied callback
346-
function. When the returned function is called, any errors that are
346+
function. When the returned function is called, any errors that are
347347
thrown will be routed to the domain's `'error'` event.
348348

349349
#### Example
@@ -370,7 +370,7 @@ d.on('error', (er) => {
370370
* `callback` {Function} The callback function
371371
* Returns: {Function} The intercepted function
372372

373-
This method is almost identical to [`domain.bind(callback)`][]. However, in
373+
This method is almost identical to [`domain.bind(callback)`][]. However, in
374374
addition to catching thrown errors, it will also intercept [`Error`][]
375375
objects sent as the first argument to the function.
376376

@@ -439,7 +439,7 @@ without exiting the domain.
439439

440440
### domain.dispose()
441441

442-
> Stability: 0 - Deprecated. Please recover from failed IO actions
442+
> Stability: 0 - Deprecated. Please recover from failed IO actions
443443
> explicitly via error event handlers set on the domain.
444444
445445
Once `dispose` has been called, the domain will no longer be used by callbacks

0 commit comments

Comments
 (0)