diff --git a/lib/address.js b/lib/address.js index bdfe7d5de..4d74e4b08 100644 --- a/lib/address.js +++ b/lib/address.js @@ -36,8 +36,8 @@ var JSUtil = require('./util/js'); * ``` * * @param {*} data - The encoded data in various formats - * @param {Network|String|number} [network] - The network: 'livenet' or 'testnet' - * @param {String} [type] - The type of address: 'script' or 'pubkey' + * @param {Network|String|number=} network - The network: 'livenet' or 'testnet' + * @param {string=} type - The type of address: 'script' or 'pubkey' * @returns {Address} A new valid and frozen instance of an Address * @constructor */ @@ -86,8 +86,8 @@ function Address(data, network, type) { /** * Internal function used to split different kinds of arguments of the constructor * @param {*} data - The encoded data in various formats - * @param {Network|String|number} [network] - The network: 'livenet' or 'testnet' - * @param {String} [type] - The type of address: 'script' or 'pubkey' + * @param {Network|String|number=} network - The network: 'livenet' or 'testnet' + * @param {string=} type - The type of address: 'script' or 'pubkey' * @returns {Object} An "info" object with "type", "network", and "hashBuffer" */ Address.prototype._classifyArguments = function(data, network, type) { @@ -186,8 +186,8 @@ Address._classifyFromVersion = function(buffer){ * Internal function to transform a bitcoin address buffer * * @param {Buffer} buffer - An instance of a hex encoded address Buffer - * @param {String} [network] - The network: 'livenet' or 'testnet' - * @param {String} [type] - The type: 'pubkeyhash' or 'scripthash' + * @param {string=} network - The network: 'livenet' or 'testnet' + * @param {string=} type - The type: 'pubkeyhash' or 'scripthash' * @returns {Object} An object with keys: hashBuffer, network and type * @private */ @@ -284,9 +284,9 @@ Address.createMultisig = function(publicKeys, threshold, network) { /** * Internal function to transform a bitcoin address string * - * @param {String} data - * @param {String|Network} [network] - either a Network instance, 'livenet', or 'testnet' - * @param {String} [type] - The type: 'pubkeyhash' or 'scripthash' + * @param {string} data + * @param {String|Network=} network - either a Network instance, 'livenet', or 'testnet' + * @param {string=} type - The type: 'pubkeyhash' or 'scripthash' * @returns {Object} An object with keys: hashBuffer, network and type * @private */ @@ -352,8 +352,8 @@ Address.fromScript = function(script, network) { * Instantiate an address from a buffer of the address * * @param {Buffer} buffer - An instance of buffer of the address - * @param {String|Network} [network] - either a Network instance, 'livenet', or 'testnet' - * @param {String} [type] - The type of address: 'script' or 'pubkey' + * @param {String|Network=} network - either a Network instance, 'livenet', or 'testnet' + * @param {string=} type - The type of address: 'script' or 'pubkey' * @returns {Address} A new valid and frozen instance of an Address */ Address.fromBuffer = function(buffer, network, type) { @@ -364,9 +364,9 @@ Address.fromBuffer = function(buffer, network, type) { /** * Instantiate an address from an address string * - * @param {String} str - An string of the bitcoin address - * @param {String|Network} [network] - either a Network instance, 'livenet', or 'testnet' - * @param {String} [type] - The type of address: 'script' or 'pubkey' + * @param {string} str - An string of the bitcoin address + * @param {String|Network=} network - either a Network instance, 'livenet', or 'testnet' + * @param {string=} type - The type of address: 'script' or 'pubkey' * @returns {Address} A new valid and frozen instance of an Address */ Address.fromString = function(str, network, type) { @@ -377,7 +377,7 @@ Address.fromString = function(str, network, type) { /** * Instantiate an address from JSON * - * @param {String} json - An JSON string or Object with keys: hash, network and type + * @param {string} json - An JSON string or Object with keys: hash, network and type * @returns {Address} A new valid instance of an Address */ Address.fromJSON = function fromJSON(json) { @@ -401,9 +401,9 @@ Address.fromJSON = function fromJSON(json) { * var error = Address.getValidationError('15vkcKf7gB23wLAnZLmbVuMiiVDc1Nm4a2', 'testnet'); * ``` * - * @param {String} data - The encoded data + * @param {string} data - The encoded data * @param {String|Network} network - either a Network instance, 'livenet', or 'testnet' - * @param {String} type - The type of address: 'script' or 'pubkey' + * @param {string} type - The type of address: 'script' or 'pubkey' * @returns {null|Error} The corresponding error message */ Address.getValidationError = function(data, network, type) { @@ -425,9 +425,9 @@ Address.getValidationError = function(data, network, type) { * assert(Address.isValid('15vkcKf7gB23wLAnZLmbVuMiiVDc1Nm4a2', 'livenet')); * ``` * - * @param {String} data - The encoded data + * @param {string} data - The encoded data * @param {String|Network} network - either a Network instance, 'livenet', or 'testnet' - * @param {String} type - The type of address: 'script' or 'pubkey' + * @param {string} type - The type of address: 'script' or 'pubkey' * @returns {boolean} The corresponding error message */ Address.isValid = function(data, network, type) { @@ -473,7 +473,7 @@ Address.prototype.toObject = function toObject() { }; /** - * @returns {String} A JSON representation of a plain object with the address information + * @returns {string} A JSON representation of a plain object with the address information */ Address.prototype.toJSON = function toJSON() { return JSON.stringify(this.toObject()); @@ -482,7 +482,7 @@ Address.prototype.toJSON = function toJSON() { /** * Will return a the string representation of the address * - * @returns {String} Bitcoin address + * @returns {string} Bitcoin address */ Address.prototype.toString = function() { return Base58Check.encode(this.toBuffer()); @@ -491,7 +491,7 @@ Address.prototype.toString = function() { /** * Will return a string formatted for the console * - * @returns {String} Bitcoin address + * @returns {string} Bitcoin address */ Address.prototype.inspect = function() { return ''; diff --git a/lib/block/block.js b/lib/block/block.js index cff63ddd7..e127797a4 100644 --- a/lib/block/block.js +++ b/lib/block/block.js @@ -125,7 +125,7 @@ Block.fromBuffer = function fromBuffer(buf) { }; /** - * @param {String} - str - A hex encoded string of the block + * @param {string} - str - A hex encoded string of the block * @returns {Block} - A hex encoded string of the block */ Block.fromString = function fromString(str) { @@ -162,7 +162,7 @@ Block.prototype.toObject = function toObject() { }; /** - * @returns {String} - A JSON string + * @returns {string} - A JSON string */ Block.prototype.toJSON = function toJSON() { return JSON.stringify(this.toObject()); @@ -176,7 +176,7 @@ Block.prototype.toBuffer = function toBuffer() { }; /** - * @returns {String} - A hex encoded string of the block + * @returns {string} - A hex encoded string of the block */ Block.prototype.toString = function toString() { return this.toBuffer().toString('hex'); @@ -286,7 +286,7 @@ Object.defineProperty(Block.prototype, 'id', idProperty); Object.defineProperty(Block.prototype, 'hash', idProperty); /** - * @returns {String} - A string formated for the console + * @returns {string} - A string formated for the console */ Block.prototype.inspect = function inspect() { return ''; diff --git a/lib/block/blockheader.js b/lib/block/blockheader.js index 44615d5a7..01f2e8171 100644 --- a/lib/block/blockheader.js +++ b/lib/block/blockheader.js @@ -105,7 +105,7 @@ BlockHeader.fromBuffer = function fromBuffer(buf) { }; /** - * @param {String} - A hex encoded buffer of the block header + * @param {string} - A hex encoded buffer of the block header * @returns {BlockHeader} - An instance of block header */ BlockHeader.fromString = function fromString(str) { @@ -153,7 +153,7 @@ BlockHeader.prototype.toObject = function toObject() { }; /** - * @returns {String} - A JSON string + * @returns {string} - A JSON string */ BlockHeader.prototype.toJSON = function toJSON() { return JSON.stringify(this.toObject()); @@ -167,7 +167,7 @@ BlockHeader.prototype.toBuffer = function toBuffer() { }; /** - * @returns {String} - A hex encoded string of the BlockHeader + * @returns {string} - A hex encoded string of the BlockHeader */ BlockHeader.prototype.toString = function toString() { return this.toBuffer().toString('hex'); @@ -254,7 +254,7 @@ BlockHeader.prototype.validProofOfWork = function validProofOfWork() { }; /** - * @returns {String} - A string formated for the console + * @returns {string} - A string formated for the console */ BlockHeader.prototype.inspect = function inspect() { return ''; diff --git a/lib/networks.js b/lib/networks.js index 96cfe35c4..51062f060 100644 --- a/lib/networks.js +++ b/lib/networks.js @@ -45,8 +45,8 @@ function getNetwork(arg, key) { * @member Networks#add * Will add a custom Network * @param {Object} data - * @param {String} data.name - The name of the network - * @param {String} data.alias - The aliased name of the network + * @param {string} data.name - The name of the network + * @param {string} data.alias - The aliased name of the network * @param {Number} data.pubkeyhash - The publickey hash prefix * @param {Number} data.privatekey - The privatekey prefix * @param {Number} data.scripthash - The scripthash prefix diff --git a/lib/opcode.js b/lib/opcode.js index 2471fbae2..d5e5a935a 100644 --- a/lib/opcode.js +++ b/lib/opcode.js @@ -236,7 +236,7 @@ Opcode.isSmallIntOp = function(opcode) { /** * Will return a string formatted for the console * - * @returns {String} Script opcode + * @returns {string} Script opcode */ Opcode.prototype.inspect = function() { return ''; diff --git a/lib/privatekey.js b/lib/privatekey.js index 822d2f57e..5af449d61 100644 --- a/lib/privatekey.js +++ b/lib/privatekey.js @@ -29,7 +29,7 @@ var Random = require('./crypto/random'); * ``` * * @param {string} data - The encoded data in various formats - * @param {Network|string} [network] - a {@link Network} object, or a string with the network name + * @param {Network|string=} network - a {@link Network} object, or a string with the network name * @returns {PrivateKey} A new valid instance of an PrivateKey * @constructor */ @@ -78,7 +78,7 @@ var PrivateKey = function PrivateKey(data, network) { * different kinds of arguments passed to the constructor. * * @param {*} data - * @param {Network|string} [network] - a {@link Network} object, or a string with the network name + * @param {Network|string=} network - a {@link Network} object, or a string with the network name * @return {Object} */ PrivateKey.prototype._classifyArguments = function(data, network) { @@ -144,7 +144,7 @@ PrivateKey._isJSON = function(json) { * Internal function to transform a WIF Buffer into a private key * * @param {Buffer} buf - An WIF string - * @param {Network|string} [network] - a {@link Network} object, or a string with the network name + * @param {Network|string=} network - a {@link Network} object, or a string with the network name * @returns {Object} An object with keys: bn, network and compressed * @private */ @@ -186,7 +186,7 @@ PrivateKey._transformBuffer = function(buf, network) { * Internal function to transform a BN buffer into a private key * * @param {Buffer} buf - * @param {Network|string} [network] - a {@link Network} object, or a string with the network name + * @param {Network|string=} network - a {@link Network} object, or a string with the network name * @returns {object} an Object with keys: bn, network, and compressed * @private */ @@ -201,7 +201,7 @@ PrivateKey._transformBNBuffer = function(buf, network) { /** * Internal function to transform a WIF string into a private key * - * @param {String} buf - An WIF string + * @param {string} buf - An WIF string * @returns {Object} An object with keys: bn, network and compressed * @private */ @@ -212,7 +212,7 @@ PrivateKey._transformWIF = function(str, network) { /** * Instantiate a PrivateKey from a JSON string * - * @param {String} json - The JSON encoded private key string + * @param {string} json - The JSON encoded private key string * @returns {PrivateKey} A new valid instance of PrivateKey */ PrivateKey.fromJSON = function(json) { @@ -238,7 +238,7 @@ PrivateKey.fromBuffer = function(arg, network) { * Internal function to transform a JSON string on plain object into a private key * return this. * - * @param {String} json - A JSON string or plain object + * @param {string} json - A JSON string or plain object * @returns {Object} An object with keys: bn, network and compressed * @private */ @@ -257,7 +257,7 @@ PrivateKey._transformJSON = function(json) { /** * Instantiate a PrivateKey from a WIF string * - * @param {String} str - The WIF encoded private key string + * @param {string} str - The WIF encoded private key string * @returns {PrivateKey} A new valid instance of PrivateKey */ PrivateKey.fromString = PrivateKey.fromWIF = function(str) { @@ -267,7 +267,7 @@ PrivateKey.fromString = PrivateKey.fromWIF = function(str) { /** * Instantiate a PrivateKey from random bytes * - * @param {String} [network] - Either "livenet" or "testnet" + * @param {string=} network - Either "livenet" or "testnet" * @returns {PrivateKey} A new valid instance of PrivateKey */ PrivateKey.fromRandom = function(network) { @@ -278,8 +278,8 @@ PrivateKey.fromRandom = function(network) { /** * Check if there would be any errors when initializing a PrivateKey * - * @param {String} data - The encoded data in various formats - * @param {String} [network] - Either "livenet" or "testnet" + * @param {string} data - The encoded data in various formats + * @param {string=} network - Either "livenet" or "testnet" * @returns {null|Error} An error if exists */ @@ -297,8 +297,8 @@ PrivateKey.getValidationError = function(data, network) { /** * Check if the parameters are valid * - * @param {String} data - The encoded data in various formats - * @param {String} [network] - Either "livenet" or "testnet" + * @param {string} data - The encoded data in various formats + * @param {string=} network - Either "livenet" or "testnet" * @returns {Boolean} If the private key is would be valid */ PrivateKey.isValid = function(data, network){ @@ -308,7 +308,7 @@ PrivateKey.isValid = function(data, network){ /** * Will output the PrivateKey encoded as hex string * - * @returns {String} + * @returns {string} */ PrivateKey.prototype.toString = function() { return this.toBuffer().toString('hex'); @@ -317,7 +317,7 @@ PrivateKey.prototype.toString = function() { /** * Will output the PrivateKey to a WIF string * - * @returns {String} A WIP representation of the private key + * @returns {string} A WIP representation of the private key */ PrivateKey.prototype.toWIF = function() { var network = this.network; @@ -394,7 +394,7 @@ PrivateKey.prototype.toJSON = function toJSON() { /** * Will return a string formatted for the console * - * @returns {String} Private key + * @returns {string} Private key */ PrivateKey.prototype.inspect = function() { var uncompressed = !this.compressed ? ', uncompressed' : ''; diff --git a/lib/publickey.js b/lib/publickey.js index 563d158d1..fd363c721 100644 --- a/lib/publickey.js +++ b/lib/publickey.js @@ -27,7 +27,7 @@ var $ = require('./util/preconditions'); * var imported = PublicKey.fromString(exported); * ``` * - * @param {String} data - The encoded data in various formats + * @param {string} data - The encoded data in various formats * @param {Object} extra - additional options * @param {Network=} extra.network - Which network should the address for this public key be for * @param {String=} extra.compressed - If the public key is compressed @@ -210,7 +210,7 @@ PublicKey._transformX = function(odd, x) { /** * Instantiate a PublicKey from JSON * - * @param {String} json - A JSON string + * @param {string} json - A JSON string * @returns {PublicKey} A new valid instance of PublicKey */ PublicKey.fromJSON = function(json) { @@ -286,7 +286,7 @@ PublicKey.fromPoint = function(point, compressed) { /** * Instantiate a PublicKey from a DER hex encoded string * - * @param {String} str - A DER hex string + * @param {string} str - A DER hex string * @param {String=} encoding - The type of string encoding * @returns {PublicKey} A new valid instance of PublicKey */ @@ -315,7 +315,7 @@ PublicKey.fromX = function(odd, x) { /** * Check if there would be any errors when initializing a PublicKey * - * @param {String} data - The encoded data in various formats + * @param {string} data - The encoded data in various formats * @returns {null|Error} An error if exists */ PublicKey.getValidationError = function(data) { @@ -332,7 +332,7 @@ PublicKey.getValidationError = function(data) { /** * Check if the parameters are valid * - * @param {String} data - The encoded data in various formats + * @param {string} data - The encoded data in various formats * @returns {Boolean} If the public key would be valid */ PublicKey.isValid = function(data) { @@ -351,7 +351,7 @@ PublicKey.prototype.toObject = function toObject() { }; /** - * @returns {String} A JSON string of the PublicKey + * @returns {string} A JSON string of the PublicKey */ PublicKey.prototype.toJSON = function toJSON() { return JSON.stringify(this.toObject()); @@ -410,7 +410,7 @@ PublicKey.prototype.toAddress = function(network) { /** * Will output the PublicKey to a DER encoded hex string * - * @returns {String} A DER hex encoded string + * @returns {string} A DER hex encoded string */ PublicKey.prototype.toString = function() { return this.toDER().toString('hex'); @@ -419,7 +419,7 @@ PublicKey.prototype.toString = function() { /** * Will return a string formatted for the console * - * @returns {String} Public key + * @returns {string} Public key */ PublicKey.prototype.inspect = function() { return ''; diff --git a/lib/uri.js b/lib/uri.js index 13c8cfdc4..a9f964fbe 100644 --- a/lib/uri.js +++ b/lib/uri.js @@ -26,7 +26,7 @@ var JSUtil = require('./util/js'); * ``` * * @param {string|Object} data - A bitcoin URI string or an Object - * @param {Array.} [knownParams] - Required non-standard params + * @param {Array.=} knownParams - Required non-standard params * @throws {TypeError} Invalid bitcoin address * @throws {TypeError} Invalid amount * @throws {Error} Unknown required argument @@ -58,7 +58,7 @@ var URI = function(data, knownParams) { /** * Instantiate a URI from a String * - * @param {String} str - JSON string or object of the URI + * @param {string} str - JSON string or object of the URI * @returns {URI} A new instance of a URI */ URI.fromString = function fromString(str) { @@ -92,7 +92,7 @@ URI.fromJSON = function fromJSON(json) { * ``` * * @param {string|Object} data - A bitcoin URI string or an Object - * @param {Array.} [knownParams] - Required non-standard params + * @param {Array.=} knownParams - Required non-standard params * @returns {boolean} Result of uri validation */ URI.isValid = function(arg, knownParams) { @@ -163,7 +163,7 @@ URI.prototype._fromObject = function(obj) { /** * Internal function to transform a BTC string amount into satoshis * - * @param {String} amount - Amount BTC string + * @param {string} amount - Amount BTC string * @throws {TypeError} Invalid amount * @returns {Object} Amount represented in satoshis */ @@ -194,7 +194,7 @@ URI.prototype.toJSON = function toJSON() { /** * Will return a the string representation of the URI * - * @returns {String} Bitcoin URI string + * @returns {string} Bitcoin URI string */ URI.prototype.toString = function() { var query = {}; @@ -222,7 +222,7 @@ URI.prototype.toString = function() { /** * Will return a string formatted for the console * - * @returns {String} Bitcoin URI + * @returns {string} Bitcoin URI */ URI.prototype.inspect = function() { return '';