Browse Source

Fix JSDocs from String to string

patch-2
eordano 10 years ago
parent
commit
fcc9081ddd
  1. 34
      lib/address.js
  2. 8
      lib/block/block.js
  3. 8
      lib/block/blockheader.js
  4. 4
      lib/networks.js
  5. 2
      lib/opcode.js
  6. 24
      lib/privatekey.js
  7. 16
      lib/publickey.js
  8. 4
      lib/unit.js
  9. 8
      lib/uri.js

34
lib/address.js

@ -37,7 +37,7 @@ 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 {string} [type] - The type of address: 'script' or 'pubkey'
* @returns {Address} A new valid and frozen instance of an Address
* @constructor
*/
@ -87,7 +87,7 @@ 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 {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} data
* @param {String|Network} [network] - either a Network instance, 'livenet', or 'testnet'
* @param {String} [type] - The type: 'pubkeyhash' or 'scripthash'
* @param {string} [type] - The type: 'pubkeyhash' or 'scripthash'
* @returns {Object} An object with keys: hashBuffer, network and type
* @private
*/
@ -353,7 +353,7 @@ Address.fromScript = function(script, network) {
*
* @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} [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} 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} [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 '<Address: ' + this.toString() + ', type: '+this.type+', network: '+this.network+'>';

8
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 '<Block ' + this.id + '>';

8
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 '<BlockHeader ' + this.id + '>';

4
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

2
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 '<Opcode: ' + this.toString() + ', hex: '+this.toHex()+', decimal: '+this.num+'>';

24
lib/privatekey.js

@ -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' : '';

16
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 '<PublicKey: ' + this.toString() +

4
lib/unit.js

@ -210,7 +210,7 @@ Unit.prototype.atRate = function(rate) {
/**
* Returns a the string representation of the value in satoshis
*
* @returns {String} the value in satoshis
* @returns {string} the value in satoshis
*/
Unit.prototype.toString = function() {
return this.satoshis + ' satoshis';
@ -235,7 +235,7 @@ Unit.prototype.toJSON = function toJSON() {
/**
* Returns a string formatted for the console
*
* @returns {String} the value in satoshis
* @returns {string} the value in satoshis
*/
Unit.prototype.inspect = function() {
return '<Unit: ' + this.toString() + '>';

8
lib/uri.js

@ -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) {
@ -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 '<URI: ' + this.toString() + '>';

Loading…
Cancel
Save