Skip to content

Commit 8532251

Browse files
Trottaddaleax
authored andcommitted
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.. PR-URL: #18890 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matheus Marchini <matheus@sthima.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
1 parent 38cf3cf commit 8532251

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
@@ -930,8 +930,6 @@ added: v8.2.0
930930
For objects whose `valueOf()` function returns a value not strictly equal to
931931
`object`, returns `Buffer.from(object.valueOf(), offsetOrEncoding, length)`.
932932

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

943-
For example:
944-
945941
```js
946942
class Foo {
947943
[Symbol.toPrimitive]() {

doc/api/child_process.md

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

229-
For example:
230-
231229
```js
232230
const util = require('util');
233231
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"
@@ -1298,9 +1292,8 @@ compiled with ICU support.
12981292
<a id="ERR_NO_LONGER_SUPPORTED"></a>
12991293
### ERR_NO_LONGER_SUPPORTED
13001294

1301-
A Node.js API was called in an unsupported manner.
1302-
1303-
For example: `Buffer.write(string, encoding, offset[, length])`
1295+
A Node.js API was called in an unsupported manner, such as
1296+
`Buffer.write(string, encoding, offset[, length])`.
13041297

13051298
<a id="ERR_OUT_OF_RANGE"></a>
13061299
### 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

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

406-
For example:
407402
```console
408403
Stats {
409404
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
@@ -1354,8 +1346,6 @@ so introduces a race condition, since other processes may change the file's
13541346
state between the two calls. Instead, user code should open/read/write the
13551347
file directly and handle the error raised if the file does not exist.
13561348

1357-
For example:
1358-
13591349
**write (NOT RECOMMENDED)**
13601350

13611351
```js

doc/api/http2.md

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

1097-
For example:
1098-
10991097
```js
11001098
const http2 = require('http2');
11011099
const client = http2.connect('https://localhost');
@@ -2008,8 +2006,6 @@ keys will be serialized to lower-case. Property values should be strings (if
20082006
they are not they will be coerced to strings) or an Array of strings (in order
20092007
to send more than one value per header field).
20102008

2011-
For example:
2012-
20132009
```js
20142010
const headers = {
20152011
':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)