From 897bbf4eb4defb20f005880e0104fd8e6aa0005e Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Sat, 16 Aug 2014 17:23:24 +1000 Subject: [PATCH] Wallet: assign indexOf in the same step --- src/wallet.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/wallet.js b/src/wallet.js index e596b66..29f124b 100644 --- a/src/wallet.js +++ b/src/wallet.js @@ -181,15 +181,13 @@ Wallet.prototype.getPrivateKey = function(index) { } Wallet.prototype.getPrivateKeyForAddress = function(address) { - if (this.addresses.indexOf(address) > -1) { - var index = this.addresses.indexOf(address) + var index + if ((index = this.addresses.indexOf(address)) > -1) { return this.getPrivateKey(index) } - if (this.changeAddresses.indexOf(address) > -1) { - var index = this.changeAddresses.indexOf(address) - + if ((index = this.changeAddresses.indexOf(address)) > -1) { return this.getInternalPrivateKey(index) }