Skip to content

Commit

Permalink
removed redundant function calls
Browse files Browse the repository at this point in the history
  • Loading branch information
nginnever committed Mar 22, 2016
1 parent 354ef96 commit c2d0ec1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/dag-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ function DAGService (blockService) {
}

if (typeof multihash === 'string') {
if (!isIPFS.multihash(multihash) && !isIPFS.path(multihash)) {
var isMhash = isIPFS.multihash(multihash)
var isPath = isIPFS.path(multihash)
if (!isMhash && !isPath) {
return callback(new Error('Invalid Key'))
}
if (isIPFS.multihash(multihash)) {
if (isMhash) {
var mhBuffer = new Buffer(base58.decode(multihash))
this.getWith(mhBuffer, callback)
}
if (isIPFS.path(multihash)) {
if (isPath) {
var ipfsKey = new Buffer(base58.decode(multihash.replace('/ipfs/', '')))
this.getWith(ipfsKey, callback)
}
Expand Down

0 comments on commit c2d0ec1

Please sign in to comment.