chore: add types checker script and more fixes on the jsdocs

This commit is contained in:
Vasco Santos
2020-11-26 19:16:35 +01:00
parent 7e05c4a43b
commit 28b9f8562c
37 changed files with 246 additions and 165 deletions

View File

@ -1,9 +1,10 @@
'use strict'
const errCode = require('err-code')
const debug = require('debug')
const log = debug('libp2p:peer-routing')
log.error = debug('libp2p:peer-routing:error')
const log = Object.assign(debug('libp2p:peer-routing'), {
error: debug('libp2p:peer-routing:err')
})
const errCode = require('err-code')
const all = require('it-all')
const pAny = require('p-any')
@ -69,7 +70,6 @@ class PeerRouting {
clearDelayedInterval(this._timeoutId)
}
<<<<<<< HEAD
/**
* Iterates over all peer routers in series to find the given peer.
*
@ -89,20 +89,6 @@ class PeerRouting {
// If we don't have a result, we need to provide an error to keep trying
if (!result || Object.keys(result).length === 0) {
throw errCode(new Error('not found'), 'NOT_FOUND')
=======
return {
/**
* Iterates over all peer routers in series to find the given peer.
*
* @param {string} id - The id of the peer to find
* @param {object} [options]
* @param {number} [options.timeout] - How long the query should run
* @returns {Promise<{ id: PeerId, multiaddrs: Multiaddr[] }>}
*/
findPeer: async (id, options) => { // eslint-disable-line require-await
if (!routers.length) {
throw errCode(new Error('No peer routers available'), 'NO_ROUTERS_AVAILABLE')
>>>>>>> chore: address review
}
return result