Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8dce85a

Browse filesBrowse files
Trotttargos
authored andcommitted
doc: format doc/api/*.md with markdown formatter
PR-URL: #40403 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 3f7c503 commit 8dce85a
Copy full SHA for 8dce85a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

58 files changed

+4253
-1138
lines changed
Open diff view settings
Collapse file

‎doc/api/addons.md‎

Copy file name to clipboardExpand all lines: doc/api/addons.md
+1Lines changed: 1 addition & 0 deletions
  • Display the source diff
  • Display the rich diff
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:
Collapse file

‎doc/api/assert.md‎

Copy file name to clipboardExpand all lines: doc/api/assert.md
+26Lines changed: 26 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
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:
@@ -629,6 +638,7 @@ parameter is an instance of an [`Error`][] then it will be thrown instead of the
629638
[`AssertionError`][].
630639

631640
## `assert.deepStrictEqual(actual, expected[, message])`
641+
632642
<!-- YAML
633643
added: v1.2.0
634644
changes:
@@ -879,6 +889,7 @@ parameter is an instance of an [`Error`][] then it will be thrown instead of the
879889
`AssertionError`.
880890

881891
## `assert.doesNotMatch(string, regexp[, message])`
892+
882893
<!-- YAML
883894
added:
884895
- v13.6.0
@@ -929,6 +940,7 @@ instance of an [`Error`][] then it will be thrown instead of the
929940
[`AssertionError`][].
930941

931942
## `assert.doesNotReject(asyncFn[, error][, message])`
943+
932944
<!-- YAML
933945
added: v10.0.0
934946
-->
@@ -1001,6 +1013,7 @@ assert.doesNotReject(Promise.reject(new TypeError('Wrong value')))
10011013
```
10021014

10031015
## `assert.doesNotThrow(fn[, error][, message])`
1016+
10041017
<!-- YAML
10051018
added: v0.1.21
10061019
changes:
@@ -1117,6 +1130,7 @@ assert.doesNotThrow(
11171130
```
11181131

11191132
## `assert.equal(actual, expected[, message])`
1133+
11201134
<!-- YAML
11211135
added: v0.1.21
11221136
changes:
@@ -1187,6 +1201,7 @@ parameter is an instance of an [`Error`][] then it will be thrown instead of the
11871201
`AssertionError`.
11881202

11891203
## `assert.fail([message])`
1204+
11901205
<!-- YAML
11911206
added: v0.1.21
11921207
-->
@@ -1227,6 +1242,7 @@ Using `assert.fail()` with more than two arguments is possible but deprecated.
12271242
See below for further details.
12281243

12291244
## `assert.fail(actual, expected[, message[, operator[, stackStartFn]]])`
1245+
12301246
<!-- YAML
12311247
added: v0.1.21
12321248
changes:
@@ -1324,6 +1340,7 @@ suppressFrame();
13241340
```
13251341

13261342
## `assert.ifError(value)`
1343+
13271344
<!-- YAML
13281345
added: v0.1.97
13291346
changes:
@@ -1397,6 +1414,7 @@ let err;
13971414
```
13981415

13991416
## `assert.match(string, regexp[, message])`
1417+
14001418
<!-- YAML
14011419
added:
14021420
- v13.6.0
@@ -1447,6 +1465,7 @@ instance of an [`Error`][] then it will be thrown instead of the
14471465
[`AssertionError`][].
14481466

14491467
## `assert.notDeepEqual(actual, expected[, message])`
1468+
14501469
<!-- YAML
14511470
added: v0.1.21
14521471
changes:
@@ -1570,6 +1589,7 @@ If the values are deeply equal, an [`AssertionError`][] is thrown with a
15701589
instead of the `AssertionError`.
15711590

15721591
## `assert.notDeepStrictEqual(actual, expected[, message])`
1592+
15731593
<!-- YAML
15741594
added: v1.2.0
15751595
changes:
@@ -1629,6 +1649,7 @@ the `message` parameter is an instance of an [`Error`][] then it will be thrown
16291649
instead of the [`AssertionError`][].
16301650

16311651
## `assert.notEqual(actual, expected[, message])`
1652+
16321653
<!-- YAML
16331654
added: v0.1.21
16341655
changes:
@@ -1693,6 +1714,7 @@ parameter is an instance of an [`Error`][] then it will be thrown instead of the
16931714
`AssertionError`.
16941715

16951716
## `assert.notStrictEqual(actual, expected[, message])`
1717+
16961718
<!-- YAML
16971719
added: v0.1.21
16981720
changes:
@@ -1745,6 +1767,7 @@ If the values are strictly equal, an [`AssertionError`][] is thrown with a
17451767
instead of the `AssertionError`.
17461768

17471769
## `assert.ok(value[, message])`
1770+
17481771
<!-- YAML
17491772
added: v0.1.21
17501773
changes:
@@ -1862,6 +1885,7 @@ assert(0);
18621885
```
18631886

18641887
## `assert.rejects(asyncFn[, error][, message])`
1888+
18651889
<!-- YAML
18661890
added: v10.0.0
18671891
-->
@@ -1982,6 +2006,7 @@ example in [`assert.throws()`][] carefully if using a string as the second
19822006
argument gets considered.
19832007

19842008
## `assert.strictEqual(actual, expected[, message])`
2009+
19852010
<!-- YAML
19862011
added: v0.1.21
19872012
changes:
@@ -2060,6 +2085,7 @@ If the values are not strictly equal, an [`AssertionError`][] is thrown with a
20602085
instead of the [`AssertionError`][].
20612086

20622087
## `assert.throws(fn[, error][, message])`
2088+
20632089
<!-- YAML
20642090
added: v0.1.21
20652091
changes:
Collapse file

‎doc/api/async_context.md‎

Copy file name to clipboardExpand all lines: doc/api/async_context.md
+13Lines changed: 13 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
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
Collapse file

‎doc/api/async_hooks.md‎

Copy file name to clipboardExpand all lines: doc/api/async_hooks.md
+7-7Lines changed: 7 additions & 7 deletions
  • Display the source diff
  • Display the rich diff
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.