Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
fix: do not destructure node callback results
Browse files Browse the repository at this point in the history
  • Loading branch information
JonKrone committed Jun 18, 2018
1 parent a7a55b9 commit d0b4a0c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/core/components/dag.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module.exports = function dag (self) {
try {
cid = new CID(cid)
} catch (err) {
callback(err)
return callback(err)
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/components/pin-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ exports = module.exports = function (dag) {

seen[bs58Link] = true

dag.get(multihash, (err, { value }) => {
dag.get(multihash, (err, res) => {
if (err) { return someCb(err) }
searchChildren(value, someCb)
searchChildren(res.value, someCb)
})
}, cb)
}
Expand Down
7 changes: 4 additions & 3 deletions src/core/components/pin.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ module.exports = function pin (self) {
// persist updated pin sets to datastore
flushPins((err, root) => {
if (err) { return callback(err) }
return callback(null, results.map(key => ({hash: key})))
return callback(null, results.map(hash => ({ hash })))
})
})
})
Expand Down Expand Up @@ -215,7 +215,7 @@ module.exports = function pin (self) {
flushPins((err, root) => {
if (err) { return callback(err) }
self.log(`Removed pins: ${results}`)
return callback(null, results.map(key => ({hash: key})))
return callback(null, results.map(hash => ({ hash })))
})
})
})
Expand Down Expand Up @@ -375,8 +375,9 @@ module.exports = function pin (self) {
async.parallel([
cb => pinset.loadSet(pinRoot.value, types.recursive, cb),
cb => pinset.loadSet(pinRoot.value, types.direct, cb)
], (err, [rKeys, dKeys]) => {
], (err, keys) => {
if (err) { return callback(err) }
const [ rKeys, dKeys ] = keys

directPins = new Set(dKeys.map(toB58String))
recursivePins = new Set(rKeys.map(toB58String))
Expand Down

0 comments on commit d0b4a0c

Please sign in to comment.