Skip to content

Commit

Permalink
refactor: simplify callbacks
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Marcin Rataj <[email protected]>
  • Loading branch information
lidel committed Jul 26, 2019
1 parent 200b25e commit 91dcbb7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class DelegatedContentRouting {
this._httpQueue.add(() =>
this.dht.findProvs(key.toString(), {
timeout: `${options.maxTimeout}ms` // The api requires specification of the time unit (s/ms)
}, callback)
).catch(callback)
})
).then(res => callback(null, res), callback)
}

/**
Expand All @@ -102,7 +102,7 @@ class DelegatedContentRouting {
*/
provide (key, callback) {
this._httpQueueRefs.add(() =>
this.refs(key.toString(), { recursive: false }, (err, res) => callback(err))
this.refs(key.toString(), { recursive: false }, (err) => callback(err))
).catch(callback)
}
}
Expand Down

0 comments on commit 91dcbb7

Please sign in to comment.