Skip to content

Commit a35e8f1

Browse files
oyydMylesBorins
authored andcommitted
doc: add types and their corresponding return values
This commit supplements some types and their corresponding return values in docs, including `AsyncResource`, `DiffieHellman`, `ECDH`, `https.Server`, `repl.REPLServer`. PR-URL: #23998 Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 74f128a commit a35e8f1

File tree

6 files changed

+22
-1
lines changed

6 files changed

+22
-1
lines changed

doc/api/async_hooks.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ alternative.
704704

705705
#### asyncResource.emitDestroy()
706706

707+
* Returns: {AsyncResource} A reference to `asyncResource`.
708+
707709
Call all `destroy` hooks. This should only ever be called once. An error will
708710
be thrown if it is called more than once. This **must** be manually called. If
709711
the resource is left to be collected by the GC then the `destroy` hooks will

doc/api/crypto.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1555,6 +1555,7 @@ changes:
15551555
* `generator` {number | string | Buffer | TypedArray | DataView} **Default:**
15561556
`2`
15571557
* `generatorEncoding` {string}
1558+
* Returns: {DiffieHellman}
15581559

15591560
Creates a `DiffieHellman` key exchange object using the supplied `prime` and an
15601561
optional specific `generator`.
@@ -1578,6 +1579,7 @@ added: v0.5.0
15781579
* `primeLength` {number}
15791580
* `generator` {number | string | Buffer | TypedArray | DataView} **Default:**
15801581
`2`
1582+
* Returns: {DiffieHellman}
15811583

15821584
Creates a `DiffieHellman` key exchange object and generates a prime of
15831585
`primeLength` bits using an optional specific numeric `generator`.
@@ -1588,6 +1590,7 @@ If `generator` is not specified, the value `2` is used.
15881590
added: v0.11.14
15891591
-->
15901592
* `curveName` {string}
1593+
* Returns: {ECDH}
15911594

15921595
Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a
15931596
predefined curve specified by the `curveName` string. Use
@@ -1840,7 +1843,7 @@ console.log(curves); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...]
18401843
added: v0.7.5
18411844
-->
18421845
* `groupName` {string}
1843-
* Returns: {Object}
1846+
* Returns: {DiffieHellman}
18441847

18451848
Creates a predefined `DiffieHellman` key exchange object. The
18461849
supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in

doc/api/https.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ This class is a subclass of `tls.Server` and emits events same as
2828
added: v0.1.90
2929
-->
3030
* `callback` {Function}
31+
* Returns: {https.Server}
3132

3233
See [`server.close()`][`http.close()`] from the HTTP module for details.
3334

@@ -49,6 +50,7 @@ added: v0.11.2
4950
-->
5051
* `msecs` {number} **Default:** `120000` (2 minutes)
5152
* `callback` {Function}
53+
* Returns: {https.Server}
5254

5355
See [`http.Server#setTimeout()`][].
5456

@@ -75,6 +77,7 @@ added: v0.3.4
7577
* `options` {Object} Accepts `options` from [`tls.createServer()`][],
7678
[`tls.createSecureContext()`][] and [`http.createServer()`][].
7779
* `requestListener` {Function} A listener to be added to the `'request'` event.
80+
* Returns: {https.Server}
7881

7982
```js
8083
// curl -k https://localhost:8000/

doc/api/repl.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ changes:
499499
* `breakEvalOnSigint` - Stop evaluating the current piece of code when
500500
`SIGINT` is received, i.e. `Ctrl+C` is pressed. This cannot be used together
501501
with a custom `eval` function. **Default:** `false`.
502+
* Returns: {repl.REPLServer}
502503

503504
The `repl.start()` method creates and starts a [`repl.REPLServer`][] instance.
504505

doc/api/tls.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ added: v0.3.2
378378

379379
* `callback` {Function} A listener callback that will be registered to listen
380380
for the server instance's `'close'` event.
381+
* Returns: {tls.Server}
381382

382383
The `server.close()` method stops the server from accepting new connections.
383384

@@ -911,6 +912,7 @@ changes:
911912
* ...: [`tls.createSecureContext()`][] options that are used if the
912913
`secureContext` option is missing, otherwise they are ignored.
913914
* `callback` {Function}
915+
* Returns: {tls.TLSSocket}
914916

915917
The `callback` function, if specified, will be added as a listener for the
916918
[`'secureConnect'`][] event.
@@ -985,6 +987,7 @@ added: v0.11.3
985987
* `path` {string} Default value for `options.path`.
986988
* `options` {Object} See [`tls.connect()`][].
987989
* `callback` {Function} See [`tls.connect()`][].
990+
* Returns: {tls.TLSSocket}
988991

989992
Same as [`tls.connect()`][] except that `path` can be provided
990993
as an argument instead of an option.
@@ -1000,6 +1003,7 @@ added: v0.11.3
10001003
* `host` {string} Default value for `options.host`.
10011004
* `options` {Object} See [`tls.connect()`][].
10021005
* `callback` {Function} See [`tls.connect()`][].
1006+
* Returns: {tls.TLSSocket}
10031007

10041008
Same as [`tls.connect()`][] except that `port` and `host` can be provided
10051009
as arguments instead of options.
@@ -1172,6 +1176,7 @@ changes:
11721176
* ...: Any [`tls.createSecureContext()`][] option can be provided. For
11731177
servers, the identity options (`pfx` or `key`/`cert`) are usually required.
11741178
* `secureConnectionListener` {Function}
1179+
* Returns: {tls.Server}
11751180

11761181
Creates a new [`tls.Server`][]. The `secureConnectionListener`, if provided, is
11771182
automatically set as a listener for the [`'secureConnection'`][] event.

tools/doc/type-parser.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const customTypesMap = {
3636
`${jsDocPrefix}Reference/Iteration_protocols#The_iterator_protocol`,
3737

3838
'AsyncHook': 'async_hooks.html#async_hooks_async_hooks_createhook_callbacks',
39+
'AsyncResource': 'async_hooks.html#async_hooks_class_asyncresource',
3940

4041
'Buffer': 'buffer.html#buffer_class_buffer',
4142

@@ -45,6 +46,8 @@ const customTypesMap = {
4546

4647
'Cipher': 'crypto.html#crypto_class_cipher',
4748
'Decipher': 'crypto.html#crypto_class_decipher',
49+
'DiffieHellman': 'crypto.html#crypto_class_diffiehellman',
50+
'ECDH': 'crypto.html#crypto_class_ecdh',
4851
'Hash': 'crypto.html#crypto_class_hash',
4952
'Hmac': 'crypto.html#crypto_class_hmac',
5053
'Sign': 'crypto.html#crypto_class_sign',
@@ -83,6 +86,8 @@ const customTypesMap = {
8386
'Http2Stream': 'http2.html#http2_class_http2stream',
8487
'ServerHttp2Stream': 'http2.html#http2_class_serverhttp2stream',
8588

89+
'https.Server': 'https.html#https_class_https_server',
90+
8691
'module': 'modules.html#modules_the_module_object',
8792

8893
'Handle': 'net.html#net_server_listen_handle_backlog_callback',
@@ -101,6 +106,8 @@ const customTypesMap = {
101106

102107
'readline.Interface': 'readline.html#readline_class_interface',
103108

109+
'repl.REPLServer': 'repl.html#repl_class_replserver',
110+
104111
'Stream': 'stream.html#stream_stream',
105112
'stream.Duplex': 'stream.html#stream_class_stream_duplex',
106113
'stream.Readable': 'stream.html#stream_class_stream_readable',

0 commit comments

Comments
 (0)