Skip to content

Commit

Permalink
doc: add types and their corresponding return values
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
oyyd authored and vsemozhetbyt committed Nov 1, 2018
1 parent 98819df commit 5689d55
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions doc/api/async_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,8 @@ alternative.

#### asyncResource.emitDestroy()

* Returns: {AsyncResource} A reference to `asyncResource`.

Call all `destroy` hooks. This should only ever be called once. An error will
be thrown if it is called more than once. This **must** be manually called. If
the resource is left to be collected by the GC then the `destroy` hooks will
Expand Down
5 changes: 4 additions & 1 deletion doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -1533,6 +1533,7 @@ changes:
* `generator` {number | string | Buffer | TypedArray | DataView} **Default:**
`2`
* `generatorEncoding` {string}
* Returns: {DiffieHellman}

Creates a `DiffieHellman` key exchange object using the supplied `prime` and an
optional specific `generator`.
Expand All @@ -1556,6 +1557,7 @@ added: v0.5.0
* `primeLength` {number}
* `generator` {number | string | Buffer | TypedArray | DataView} **Default:**
`2`
* Returns: {DiffieHellman}

Creates a `DiffieHellman` key exchange object and generates a prime of
`primeLength` bits using an optional specific numeric `generator`.
Expand All @@ -1566,6 +1568,7 @@ If `generator` is not specified, the value `2` is used.
added: v0.11.14
-->
* `curveName` {string}
* Returns: {ECDH}

Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a
predefined curve specified by the `curveName` string. Use
Expand Down Expand Up @@ -1818,7 +1821,7 @@ console.log(curves); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...]
added: v0.7.5
-->
* `groupName` {string}
* Returns: {Object}
* Returns: {DiffieHellman}

Creates a predefined `DiffieHellman` key exchange object. The
supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in
Expand Down
3 changes: 3 additions & 0 deletions doc/api/https.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ This class is a subclass of `tls.Server` and emits events same as
added: v0.1.90
-->
* `callback` {Function}
* Returns: {https.Server}

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

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

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

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

```js
// curl -k https://localhost:8000/
Expand Down
1 change: 1 addition & 0 deletions doc/api/repl.md
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ changes:
* `breakEvalOnSigint` - Stop evaluating the current piece of code when
`SIGINT` is received, i.e. `Ctrl+C` is pressed. This cannot be used together
with a custom `eval` function. **Default:** `false`.
* Returns: {repl.REPLServer}

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

Expand Down
5 changes: 5 additions & 0 deletions doc/api/tls.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ added: v0.3.2

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

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

Expand Down Expand Up @@ -926,6 +927,7 @@ changes:
* ...: [`tls.createSecureContext()`][] options that are used if the
`secureContext` option is missing, otherwise they are ignored.
* `callback` {Function}
* Returns: {tls.TLSSocket}

The `callback` function, if specified, will be added as a listener for the
[`'secureConnect'`][] event.
Expand Down Expand Up @@ -1000,6 +1002,7 @@ added: v0.11.3
* `path` {string} Default value for `options.path`.
* `options` {Object} See [`tls.connect()`][].
* `callback` {Function} See [`tls.connect()`][].
* Returns: {tls.TLSSocket}

Same as [`tls.connect()`][] except that `path` can be provided
as an argument instead of an option.
Expand All @@ -1015,6 +1018,7 @@ added: v0.11.3
* `host` {string} Default value for `options.host`.
* `options` {Object} See [`tls.connect()`][].
* `callback` {Function} See [`tls.connect()`][].
* Returns: {tls.TLSSocket}

Same as [`tls.connect()`][] except that `port` and `host` can be provided
as arguments instead of options.
Expand Down Expand Up @@ -1191,6 +1195,7 @@ changes:
* ...: Any [`tls.createSecureContext()`][] option can be provided. For
servers, the identity options (`pfx` or `key`/`cert`) are usually required.
* `secureConnectionListener` {Function}
* Returns: {tls.Server}

Creates a new [`tls.Server`][]. The `secureConnectionListener`, if provided, is
automatically set as a listener for the [`'secureConnection'`][] event.
Expand Down
7 changes: 7 additions & 0 deletions tools/doc/type-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const customTypesMap = {
`${jsDocPrefix}Reference/Iteration_protocols#The_iterator_protocol`,

'AsyncHook': 'async_hooks.html#async_hooks_async_hooks_createhook_callbacks',
'AsyncResource': 'async_hooks.html#async_hooks_class_asyncresource',

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

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

'Cipher': 'crypto.html#crypto_class_cipher',
'Decipher': 'crypto.html#crypto_class_decipher',
'DiffieHellman': 'crypto.html#crypto_class_diffiehellman',
'ECDH': 'crypto.html#crypto_class_ecdh',
'Hash': 'crypto.html#crypto_class_hash',
'Hmac': 'crypto.html#crypto_class_hmac',
'Sign': 'crypto.html#crypto_class_sign',
Expand Down Expand Up @@ -83,6 +86,8 @@ const customTypesMap = {
'Http2Stream': 'http2.html#http2_class_http2stream',
'ServerHttp2Stream': 'http2.html#http2_class_serverhttp2stream',

'https.Server': 'https.html#https_class_https_server',

'module': 'modules.html#modules_the_module_object',

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

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

'repl.REPLServer': 'repl.html#repl_class_replserver',

'Stream': 'stream.html#stream_stream',
'stream.Duplex': 'stream.html#stream_class_stream_duplex',
'stream.Readable': 'stream.html#stream_class_stream_readable',
Expand Down

0 comments on commit 5689d55

Please sign in to comment.