From c2d0ec182d128ba353510df9a9efc2255d2b07e9 Mon Sep 17 00:00:00 2001 From: nginnever Date: Tue, 22 Mar 2016 14:40:57 -0700 Subject: [PATCH] removed redundant function calls --- src/dag-service.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/dag-service.js b/src/dag-service.js index a2a5267..f2b2e3d 100644 --- a/src/dag-service.js +++ b/src/dag-service.js @@ -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) }