From 4bb7f5b56d940d0f3936c80219f01560febaafc0 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Sat, 16 Aug 2014 17:15:13 +1000 Subject: [PATCH] Wallet: use indexOf explicitly over include* --- src/wallet.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/wallet.js b/src/wallet.js index 6e26612..3b3daeb 100644 --- a/src/wallet.js +++ b/src/wallet.js @@ -137,13 +137,13 @@ Wallet.prototype.getPrivateKey = function(index) { } Wallet.prototype.getPrivateKeyForAddress = function(address) { - if (includeAddress(this.addresses, address)) { + if (this.addresses.indexOf(address) > -1) { var index = this.addresses.indexOf(address) return this.getPrivateKey(index) } - if (includeAddress(this.changeAddresses, address)) { + if (this.changeAddresses.indexOf(address) > -1) { var index = this.changeAddresses.indexOf(address) return this.getInternalPrivateKey(index) @@ -266,7 +266,7 @@ function processTx(tx, isPending) { } var myAddresses = this.addresses.concat(this.changeAddresses) - if (includeAddress(myAddresses, address)) { + if (myAddresses.indexOf(address) > -1) { var output = txid + ':' + i this.outputs[output] = { @@ -297,8 +297,4 @@ function processTx(tx, isPending) { }, this) } -function includeAddress(addresses, address) { - return addresses.indexOf(address) > -1 -} - module.exports = Wallet