Skip to content

Commit 621266a

Browse files
Trotttargos
authored andcommitted
doc: format doc/api/*.md with markdown formatter
PR-URL: #40403 Backport-PR-URL: #40530 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Zijian Liu <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent 6de88bc commit 621266a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+4225
-1145
lines changed

doc/api/addons.md

+1
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ NODE_MODULE_INIT(/* exports, module, context */) {
235235
```
236236
237237
#### Worker support
238+
238239
<!-- YAML
239240
changes:
240241
- version:

doc/api/assert.md

+26
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The `assert` module provides a set of assertion functions for verifying
1010
invariants.
1111

1212
## Strict assertion mode
13+
1314
<!-- YAML
1415
added: v9.9.0
1516
changes:
@@ -138,6 +139,7 @@ Indicates the failure of an assertion. All errors thrown by the `assert` module
138139
will be instances of the `AssertionError` class.
139140

140141
### `new assert.AssertionError(options)`
142+
141143
<!-- YAML
142144
added: v0.1.21
143145
-->
@@ -216,6 +218,7 @@ try {
216218
```
217219

218220
## Class: `assert.CallTracker`
221+
219222
<!-- YAML
220223
added:
221224
- v14.2.0
@@ -227,6 +230,7 @@ added:
227230
This feature is currently experimental and behavior might still change.
228231

229232
### `new assert.CallTracker()`
233+
230234
<!-- YAML
231235
added:
232236
- v14.2.0
@@ -278,6 +282,7 @@ process.on('exit', () => {
278282
```
279283

280284
### `tracker.calls([fn][, exact])`
285+
281286
<!-- YAML
282287
added:
283288
- v14.2.0
@@ -320,6 +325,7 @@ const callsfunc = tracker.calls(func);
320325
```
321326

322327
### `tracker.report()`
328+
323329
<!-- YAML
324330
added:
325331
- v14.2.0
@@ -396,6 +402,7 @@ tracker.report();
396402
```
397403

398404
### `tracker.verify()`
405+
399406
<!-- YAML
400407
added:
401408
- v14.2.0
@@ -443,6 +450,7 @@ tracker.verify();
443450
```
444451

445452
## `assert(value[, message])`
453+
446454
<!-- YAML
447455
added: v0.5.9
448456
-->
@@ -453,6 +461,7 @@ added: v0.5.9
453461
An alias of [`assert.ok()`][].
454462

455463
## `assert.deepEqual(actual, expected[, message])`
464+
456465
<!-- YAML
457466
added: v0.1.21
458467
changes:
@@ -627,6 +636,7 @@ parameter is an instance of an [`Error`][] then it will be thrown instead of the
627636
[`AssertionError`][].
628637

629638
## `assert.deepStrictEqual(actual, expected[, message])`
639+
630640
<!-- YAML
631641
added: v1.2.0
632642
changes:
@@ -877,6 +887,7 @@ parameter is an instance of an [`Error`][] then it will be thrown instead of the
877887
`AssertionError`.
878888

879889
## `assert.doesNotMatch(string, regexp[, message])`
890+
880891
<!-- YAML
881892
added:
882893
- v13.6.0
@@ -927,6 +938,7 @@ instance of an [`Error`][] then it will be thrown instead of the
927938
[`AssertionError`][].
928939

929940
## `assert.doesNotReject(asyncFn[, error][, message])`
941+
930942
<!-- YAML
931943
added: v10.0.0
932944
-->
@@ -999,6 +1011,7 @@ assert.doesNotReject(Promise.reject(new TypeError('Wrong value')))
9991011
```
10001012

10011013
## `assert.doesNotThrow(fn[, error][, message])`
1014+
10021015
<!-- YAML
10031016
added: v0.1.21
10041017
changes:
@@ -1115,6 +1128,7 @@ assert.doesNotThrow(
11151128
```
11161129

11171130
## `assert.equal(actual, expected[, message])`
1131+
11181132
<!-- YAML
11191133
added: v0.1.21
11201134
changes:
@@ -1183,6 +1197,7 @@ parameter is an instance of an [`Error`][] then it will be thrown instead of the
11831197
`AssertionError`.
11841198

11851199
## `assert.fail([message])`
1200+
11861201
<!-- YAML
11871202
added: v0.1.21
11881203
-->
@@ -1223,6 +1238,7 @@ Using `assert.fail()` with more than two arguments is possible but deprecated.
12231238
See below for further details.
12241239

12251240
## `assert.fail(actual, expected[, message[, operator[, stackStartFn]]])`
1241+
12261242
<!-- YAML
12271243
added: v0.1.21
12281244
changes:
@@ -1320,6 +1336,7 @@ suppressFrame();
13201336
```
13211337

13221338
## `assert.ifError(value)`
1339+
13231340
<!-- YAML
13241341
added: v0.1.97
13251342
changes:
@@ -1393,6 +1410,7 @@ let err;
13931410
```
13941411

13951412
## `assert.match(string, regexp[, message])`
1413+
13961414
<!-- YAML
13971415
added:
13981416
- v13.6.0
@@ -1443,6 +1461,7 @@ instance of an [`Error`][] then it will be thrown instead of the
14431461
[`AssertionError`][].
14441462

14451463
## `assert.notDeepEqual(actual, expected[, message])`
1464+
14461465
<!-- YAML
14471466
added: v0.1.21
14481467
changes:
@@ -1564,6 +1583,7 @@ If the values are deeply equal, an [`AssertionError`][] is thrown with a
15641583
instead of the `AssertionError`.
15651584

15661585
## `assert.notDeepStrictEqual(actual, expected[, message])`
1586+
15671587
<!-- YAML
15681588
added: v1.2.0
15691589
changes:
@@ -1623,6 +1643,7 @@ the `message` parameter is an instance of an [`Error`][] then it will be thrown
16231643
instead of the [`AssertionError`][].
16241644

16251645
## `assert.notEqual(actual, expected[, message])`
1646+
16261647
<!-- YAML
16271648
added: v0.1.21
16281649
changes:
@@ -1685,6 +1706,7 @@ parameter is an instance of an [`Error`][] then it will be thrown instead of the
16851706
`AssertionError`.
16861707

16871708
## `assert.notStrictEqual(actual, expected[, message])`
1709+
16881710
<!-- YAML
16891711
added: v0.1.21
16901712
changes:
@@ -1737,6 +1759,7 @@ If the values are strictly equal, an [`AssertionError`][] is thrown with a
17371759
instead of the `AssertionError`.
17381760

17391761
## `assert.ok(value[, message])`
1762+
17401763
<!-- YAML
17411764
added: v0.1.21
17421765
changes:
@@ -1854,6 +1877,7 @@ assert(0);
18541877
```
18551878

18561879
## `assert.rejects(asyncFn[, error][, message])`
1880+
18571881
<!-- YAML
18581882
added: v10.0.0
18591883
-->
@@ -1974,6 +1998,7 @@ example in [`assert.throws()`][] carefully if using a string as the second
19741998
argument gets considered.
19751999

19762000
## `assert.strictEqual(actual, expected[, message])`
2001+
19772002
<!-- YAML
19782003
added: v0.1.21
19792004
changes:
@@ -2052,6 +2077,7 @@ If the values are not strictly equal, an [`AssertionError`][] is thrown with a
20522077
instead of the [`AssertionError`][].
20532078

20542079
## `assert.throws(fn[, error][, message])`
2080+
20552081
<!-- YAML
20562082
added: v0.1.21
20572083
changes:

doc/api/async_context.md

+13
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<!-- source_link=lib/async_hooks.js -->
88

99
## Introduction
10+
1011
These classes are used to associate state and propagate it throughout
1112
callbacks and promise chains.
1213
They allow storing data throughout the lifetime of a web request
@@ -25,6 +26,7 @@ const async_hooks = require('async_hooks');
2526
```
2627

2728
## Class: `AsyncLocalStorage`
29+
2830
<!-- YAML
2931
added:
3032
- v13.10.0
@@ -115,6 +117,7 @@ Multiple instances can safely exist simultaneously without risk of interfering
115117
with each other data.
116118

117119
### `new AsyncLocalStorage()`
120+
118121
<!-- YAML
119122
added:
120123
- v13.10.0
@@ -125,6 +128,7 @@ Creates a new instance of `AsyncLocalStorage`. Store is only provided within a
125128
`run()` call or after an `enterWith()` call.
126129

127130
### `asyncLocalStorage.disable()`
131+
128132
<!-- YAML
129133
added:
130134
- v13.10.0
@@ -149,6 +153,7 @@ Use this method when the `asyncLocalStorage` is not in use anymore
149153
in the current process.
150154

151155
### `asyncLocalStorage.getStore()`
156+
152157
<!-- YAML
153158
added:
154159
- v13.10.0
@@ -163,6 +168,7 @@ calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it
163168
returns `undefined`.
164169

165170
### `asyncLocalStorage.enterWith(store)`
171+
166172
<!-- YAML
167173
added:
168174
- v13.11.0
@@ -212,6 +218,7 @@ asyncLocalStorage.getStore(); // Returns the same object
212218
```
213219

214220
### `asyncLocalStorage.run(store, callback[, ...args])`
221+
215222
<!-- YAML
216223
added:
217224
- v13.10.0
@@ -251,6 +258,7 @@ try {
251258
```
252259

253260
### `asyncLocalStorage.exit(callback[, ...args])`
261+
254262
<!-- YAML
255263
added:
256264
- v13.10.0
@@ -326,6 +334,7 @@ the loss. When the code logs `undefined`, the last callback called is probably
326334
responsible for the context loss.
327335

328336
## Class: `AsyncResource`
337+
329338
<!-- YAML
330339
changes:
331340
- version: v16.4.0
@@ -434,6 +443,7 @@ class DBQuery extends AsyncResource {
434443
```
435444

436445
### Static method: `AsyncResource.bind(fn[, type, [thisArg]])`
446+
437447
<!-- YAML
438448
added:
439449
- v14.8.0
@@ -455,6 +465,7 @@ The returned function will have an `asyncResource` property referencing
455465
the `AsyncResource` to which the function is bound.
456466

457467
### `asyncResource.bind(fn[, thisArg])`
468+
458469
<!-- YAML
459470
added:
460471
- v14.8.0
@@ -474,6 +485,7 @@ The returned function will have an `asyncResource` property referencing
474485
the `AsyncResource` to which the function is bound.
475486

476487
### `asyncResource.runInAsyncScope(fn[, thisArg, ...args])`
488+
477489
<!-- YAML
478490
added: v9.6.0
479491
-->
@@ -507,6 +519,7 @@ never be called.
507519
`AsyncResource` constructor.
508520

509521
<a id="async-resource-worker-pool"></a>
522+
510523
### Using `AsyncResource` for a `Worker` thread pool
511524

512525
The following example shows how to use the `AsyncResource` class to properly

doc/api/async_hooks.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ const asyncHook = async_hooks.createHook(new MyAddedCallbacks());
190190

191191
Because promises are asynchronous resources whose lifecycle is tracked
192192
via the async hooks mechanism, the `init()`, `before()`, `after()`, and
193-
`destroy()` callbacks *must not* be async functions that return promises.
193+
`destroy()` callbacks _must not_ be async functions that return promises.
194194

195195
### Error handling
196196

@@ -350,8 +350,8 @@ listening to the hooks.
350350

351351
`triggerAsyncId` is the `asyncId` of the resource that caused (or "triggered")
352352
the new resource to initialize and that caused `init` to call. This is different
353-
from `async_hooks.executionAsyncId()` that only shows *when* a resource was
354-
created, while `triggerAsyncId` shows *why* a resource was created.
353+
from `async_hooks.executionAsyncId()` that only shows _when_ a resource was
354+
created, while `triggerAsyncId` shows _why_ a resource was created.
355355

356356
The following is a simple demonstration of `triggerAsyncId`:
357357

@@ -499,13 +499,13 @@ TickObject(6)
499499

500500
The `TCPSERVERWRAP` is not part of this graph, even though it was the reason for
501501
`console.log()` being called. This is because binding to a port without a host
502-
name is a *synchronous* operation, but to maintain a completely asynchronous
502+
name is a _synchronous_ operation, but to maintain a completely asynchronous
503503
API the user's callback is placed in a `process.nextTick()`. Which is why
504504
`TickObject` is present in the output and is a 'parent' for `.listen()`
505505
callback.
506506

507-
The graph only shows *when* a resource was created, not *why*, so to track
508-
the *why* use `triggerAsyncId`. Which can be represented with the following
507+
The graph only shows _when_ a resource was created, not _why_, so to track
508+
the _why_ use `triggerAsyncId`. Which can be represented with the following
509509
graph:
510510

511511
```console
@@ -545,7 +545,7 @@ it only once.
545545
Called immediately after the callback specified in `before` is completed.
546546

547547
If an uncaught exception occurs during execution of the callback, then `after`
548-
will run *after* the `'uncaughtException'` event is emitted or a `domain`'s
548+
will run _after_ the `'uncaughtException'` event is emitted or a `domain`'s
549549
handler runs.
550550

551551
#### `destroy(asyncId)`

0 commit comments

Comments
 (0)