mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-28 08:21:33 +00:00
chore: add typedefs
This commit is contained in:
@ -6,12 +6,17 @@ const errCode = require('err-code')
|
||||
|
||||
const { codes } = require('./errors')
|
||||
|
||||
/**
|
||||
* @typedef {import('peer-id')} PeerId
|
||||
* @typedef {import('multiaddr')} multiaddr
|
||||
*/
|
||||
|
||||
/**
|
||||
* Converts the given `peer` to a `Peer` object.
|
||||
* If a multiaddr is received, the addressBook is updated.
|
||||
*
|
||||
* @param {PeerId|Multiaddr|string} peer
|
||||
* @returns {{ id: PeerId, multiaddrs: Array<Multiaddr> }}
|
||||
* @param {PeerId|multiaddr|string} peer
|
||||
* @returns {{ id: PeerId, multiaddrs: Array<multiaddr> }}
|
||||
*/
|
||||
function getPeer (peer) {
|
||||
if (typeof peer === 'string') {
|
||||
|
Reference in New Issue
Block a user