docs: update addressBook get and getMultiaddrsForPeer return values (#716)

This commit is contained in:
Vasco Santos 2020-07-20 16:17:39 +02:00 committed by GitHub
parent 7da9ad44ab
commit cea59a1fe4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 4 deletions

View File

@ -760,7 +760,7 @@ Get the known [`Addresses`][address] of a provided peer.
| Type | Description | | Type | Description |
|------|-------------| |------|-------------|
| `Array<Address>` | Array of peer's [`Addresses`][address] containing the multiaddr and its metadata | | `Array<Address>|undefined` | Array of peer's [`Addresses`][address] containing the multiaddr and its metadata if available, otherwise undefined |
#### Example #### Example
@ -797,7 +797,7 @@ Get the known `Multiaddr` of a provided peer. All returned multiaddrs will inclu
| Type | Description | | Type | Description |
|------|-------------| |------|-------------|
| `Array<Multiaddr>` | Array of peer's multiaddr | | `Array<Multiaddr>|undefined` | Array of peer's multiaddr if available, otherwise undefined |
#### Example #### Example

View File

@ -168,8 +168,9 @@ class AddressBook extends Book {
/** /**
* Get the known multiaddrs for a given peer. All returned multiaddrs * Get the known multiaddrs for a given peer. All returned multiaddrs
* will include the encapsulated `PeerId` of the peer. * will include the encapsulated `PeerId` of the peer.
* Returns `undefined` if there are no known multiaddrs for the given peer.
* @param {PeerId} peerId * @param {PeerId} peerId
* @returns {Array<Multiaddr>} * @returns {Array<Multiaddr>|undefined}
*/ */
getMultiaddrsForPeer (peerId) { getMultiaddrsForPeer (peerId) {
if (!PeerId.isPeerId(peerId)) { if (!PeerId.isPeerId(peerId)) {

View File

@ -77,8 +77,9 @@ class Book {
/** /**
* Get the known data of a provided peer. * Get the known data of a provided peer.
* Returns `undefined` if there is no available data for the given peer.
* @param {PeerId} peerId * @param {PeerId} peerId
* @returns {Array<Data>} * @returns {Array<Data>|undefined}
*/ */
get (peerId) { get (peerId) {
if (!PeerId.isPeerId(peerId)) { if (!PeerId.isPeerId(peerId)) {