Skip to content

Commit 4dad02b

Browse files
committed
doc: remove extraneous "for example" text
No need to announce obvious example code as being example code. Remove unneeded "for example" text as one small way to try to keep the docs more concise..
1 parent 6934792 commit 4dad02b

22 files changed

+12
-127
lines changed

doc/api/addons.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ Each of these examples using the following `binding.gyp` file:
292292
```
293293

294294
In cases where there is more than one `.cc` file, simply add the additional
295-
filename to the `sources` array. For example:
295+
filename to the `sources` array:
296296

297297
```json
298298
"sources": ["addon.cc", "myexample.cc"]

doc/api/async_hooks.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,6 @@ Note that `resolve()` does not do any observable synchronous work.
451451
rejected at this point, if the `Promise` was resolved by assuming the state
452452
of another `Promise`.
453453

454-
For example:
455-
456454
```js
457455
new Promise((resolve) => resolve(true)).then((a) => {});
458456
```
@@ -481,8 +479,6 @@ changes:
481479
* Returns: {number} The `asyncId` of the current execution context. Useful to
482480
track when something calls.
483481

484-
For example:
485-
486482
```js
487483
const async_hooks = require('async_hooks');
488484

@@ -493,7 +489,7 @@ fs.open(path, 'r', (err, fd) => {
493489
```
494490

495491
The ID returned from `executionAsyncId()` is related to execution timing, not
496-
causality (which is covered by `triggerAsyncId()`). For example:
492+
causality (which is covered by `triggerAsyncId()`):
497493

498494
```js
499495
const server = net.createServer(function onConnection(conn) {
@@ -517,8 +513,6 @@ See the section on [promise execution tracking][].
517513
* Returns: {number} The ID of the resource responsible for calling the callback
518514
that is currently being executed.
519515

520-
For example:
521-
522516
```js
523517
const server = net.createServer((conn) => {
524518
// The resource that caused (or triggered) this callback to be called

doc/api/buffer.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -925,8 +925,6 @@ added: v8.2.0
925925
For objects whose `valueOf()` function returns a value not strictly equal to
926926
`object`, returns `Buffer.from(object.valueOf(), offsetOrEncoding, length)`.
927927

928-
For example:
929-
930928
```js
931929
const buf = Buffer.from(new String('this is a test'));
932930
// Prints: <Buffer 74 68 69 73 20 69 73 20 61 20 74 65 73 74>
@@ -935,8 +933,6 @@ const buf = Buffer.from(new String('this is a test'));
935933
For objects that support `Symbol.toPrimitive`, returns
936934
`Buffer.from(object[Symbol.toPrimitive](), offsetOrEncoding, length)`.
937935

938-
For example:
939-
940936
```js
941937
class Foo {
942938
[Symbol.toPrimitive]() {

doc/api/child_process.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,6 @@ a Promise for an object with `stdout` and `stderr` properties. In case of an
225225
error, a rejected promise is returned, with the same `error` object given in the
226226
callback, but with an additional two properties `stdout` and `stderr`.
227227

228-
For example:
229-
230228
```js
231229
const util = require('util');
232230
const exec = util.promisify(require('child_process').exec);

doc/api/dns.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ Returns an array of IP address strings, formatted according to [rfc5952][],
114114
that are currently configured for DNS resolution. A string will include a port
115115
section if a custom port is used.
116116

117-
For example:
118-
119117
<!-- eslint-disable semi-->
120118
```js
121119
[
@@ -369,8 +367,6 @@ function will contain an array of objects with the following properties:
369367
* `order`
370368
* `preference`
371369

372-
For example:
373-
374370
<!-- eslint-skip -->
375371
```js
376372
{
@@ -558,8 +554,6 @@ Sets the IP address and port of servers to be used when performing DNS
558554
resolution. The `servers` argument is an array of [rfc5952][] formatted
559555
addresses. If the port is the IANA default DNS port (53) it can be omitted.
560556

561-
For example:
562-
563557
```js
564558
dns.setServers([
565559
'4.4.4.4',

doc/api/domain.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,6 @@ perhaps we would like to have a separate domain to use for each request.
239239

240240
That is possible via explicit binding.
241241

242-
For example:
243-
244242
```js
245243
// create a top-level domain for the server
246244
const domain = require('domain');

doc/api/errors.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,6 @@ console.error(err.message);
292292
The `error.stack` property is a string describing the point in the code at which
293293
the `Error` was instantiated.
294294

295-
For example:
296-
297295
```txt
298296
Error: Things keep happening!
299297
at /home/gbusey/file.js:525:2
@@ -368,8 +366,6 @@ detailed [here](#errors_system_errors).
368366
A subclass of `Error` that indicates the failure of an assertion. Such errors
369367
commonly indicate inequality of actual and expected value.
370368

371-
For example:
372-
373369
```js
374370
assert.strictEqual(1, 2);
375371
// AssertionError [ERR_ASSERTION]: 1 === 2
@@ -381,8 +377,6 @@ A subclass of `Error` that indicates that a provided argument was not within the
381377
set or range of acceptable values for a function; whether that is a numeric
382378
range, or outside the set of options for a given function parameter.
383379

384-
For example:
385-
386380
```js
387381
require('net').connect(-1);
388382
// throws "RangeError: "port" option should be >= 0 and < 65536: -1"
@@ -1354,9 +1348,8 @@ compiled with ICU support.
13541348
<a id="ERR_NO_LONGER_SUPPORTED"></a>
13551349
### ERR_NO_LONGER_SUPPORTED
13561350

1357-
A Node.js API was called in an unsupported manner.
1358-
1359-
For example: `Buffer.write(string, encoding, offset[, length])`
1351+
A Node.js API was called in an unsupported manner, such as
1352+
`Buffer.write(string, encoding, offset[, length])`.
13601353

13611354
<a id="ERR_OUT_OF_RANGE"></a>
13621355
### ERR_OUT_OF_RANGE

doc/api/fs.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ The arguments passed to the completion callback depend on the method, but the
2222
first argument is always reserved for an exception. If the operation was
2323
completed successfully, then the first argument will be `null` or `undefined`.
2424

25-
For example:
26-
2725
```js
2826
const fs = require('fs');
2927

@@ -36,8 +34,6 @@ fs.unlink('/tmp/hello', (err) => {
3634
Exceptions that occur using synchronous operations are thrown immediately and
3735
may be handled using `try`/`catch`, or may be allowed to bubble up.
3836

39-
For example:
40-
4137
```js
4238
const fs = require('fs');
4339

@@ -402,7 +398,6 @@ A `fs.Stats` object provides information about a file.
402398
Objects returned from [`fs.stat()`][], [`fs.lstat()`][] and [`fs.fstat()`][] and
403399
their synchronous counterparts are of this type.
404400

405-
For example:
406401
```console
407402
Stats {
408403
dev: 2114,
@@ -703,9 +698,6 @@ so introduces a race condition, since other processes may change the file's
703698
state between the two calls. Instead, user code should open/read/write the
704699
file directly and handle the error raised if the file is not accessible.
705700

706-
For example:
707-
708-
709701
**write (NOT RECOMMENDED)**
710702

711703
```js
@@ -1356,8 +1348,6 @@ so introduces a race condition, since other processes may change the file's
13561348
state between the two calls. Instead, user code should open/read/write the
13571349
file directly and handle the error raised if the file does not exist.
13581350

1359-
For example:
1360-
13611351
**write (NOT RECOMMENDED)**
13621352

13631353
```js

doc/api/http2.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,8 +1090,6 @@ received for this stream from the connected HTTP/2 server. The listener is
10901090
invoked with two arguments: an Object containing the received
10911091
[HTTP2 Headers Object][], and flags associated with the headers.
10921092

1093-
For example:
1094-
10951093
```js
10961094
const http2 = require('http2');
10971095
const client = http2.connect('https://localhost');
@@ -2001,8 +1999,6 @@ keys will be serialized to lower-case. Property values should be strings (if
20011999
they are not they will be coerced to strings) or an Array of strings (in order
20022000
to send more than one value per header field).
20032001

2004-
For example:
2005-
20062002
```js
20072003
const headers = {
20082004
':status': '200',

doc/api/modules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ exports = { hello: false }; // Not exported, only available in the module
729729
```
730730

731731
When the `module.exports` property is being completely replaced by a new
732-
object, it is common to also reassign `exports`, for example:
732+
object, it is common to also reassign `exports`:
733733

734734
<!-- eslint-disable func-name-matching -->
735735
```js

0 commit comments

Comments
 (0)