From 4e04a7e8835493de4cc24aad4d954c590ea1fd54 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Mon, 8 Sep 2014 23:15:31 +1000 Subject: [PATCH] Transaction: use isFinite over Number.isFinite --- src/transaction.js | 6 +++--- src/wallet.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/transaction.js b/src/transaction.js index 39ab488..29e1a43 100644 --- a/src/transaction.js +++ b/src/transaction.js @@ -49,8 +49,8 @@ Transaction.prototype.addInput = function(tx, index, sequence) { assert(Buffer.isBuffer(hash), 'Expected Transaction, txId or txHash, got ' + tx) assert.equal(hash.length, 32, 'Expected hash length of 32, got ' + hash.length) - assert(Number.isFinite(index), 'Expected number index, got ' + index) - assert(Number.isFinite(sequence), 'Expected number sequence, got ' + sequence) + assert(isFinite(index), 'Expected number index, got ' + index) + assert(isFinite(sequence), 'Expected number sequence, got ' + sequence) // Add the input and return the input's index return (this.ins.push({ @@ -82,7 +82,7 @@ Transaction.prototype.addOutput = function(scriptPubKey, value) { } assert(scriptPubKey instanceof Script, 'Expected Address or Script, got ' + scriptPubKey) - assert(Number.isFinite(value), 'Expected number value, got ' + value) + assert(isFinite(value), 'Expected number value, got ' + value) // Add the output and return the output's index return (this.outs.push({ diff --git a/src/wallet.js b/src/wallet.js index d131e01..c61715f 100644 --- a/src/wallet.js +++ b/src/wallet.js @@ -303,7 +303,7 @@ Wallet.prototype.setUnspentOutputs = function(unspents) { assert.equal(typeof txId, 'string', 'Expected txId, got ' + txId) assert.equal(txId.length, 64, 'Expected valid txId, got ' + txId) assert.doesNotThrow(function() { Address.fromBase58Check(unspent.address) }, 'Expected Base58 Address, got ' + unspent.address) - assert(Number.isFinite(index), 'Expected number index, got ' + index) + assert(isFinite(index), 'Expected number index, got ' + index) assert.equal(typeof unspent.value, 'number', 'Expected number value, got ' + unspent.value) // FIXME: remove branch in 2.0.0