Standardize optional parameters to Closure syntax

This commit is contained in:
eordano 2015-02-24 15:12:03 -03:00
parent fcc9081ddd
commit 575993967c
5 changed files with 25 additions and 25 deletions

View File

@ -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
*/
@ -285,8 +285,8 @@ 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|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) {
@ -365,8 +365,8 @@ 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|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) {

View File

@ -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
*/
@ -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) {
@ -279,7 +279,7 @@ 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=} network - Either "livenet" or "testnet"
* @returns {null|Error} An error if exists
*/
@ -298,7 +298,7 @@ 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=} network - Either "livenet" or "testnet"
* @returns {Boolean} If the private key is would be valid
*/
PrivateKey.isValid = function(data, network){

View File

@ -37,7 +37,7 @@ var Interpreter = function Interpreter(obj) {
* separately.
* @param {Script} scriptSig - the script's first part (corresponding to the tx input)
* @param {Script} scriptPubkey - the script's last part (corresponding to the tx output)
* @param {Transaction} [tx] - the Transaction containing the scriptSig in one input (used
* @param {Transaction=} tx - the Transaction containing the scriptSig in one input (used
* to check signature validity for some opcodes like OP_CHECKSIG)
* @param {number} nin - index of the transaction input containing the scriptSig verified.
* @param {number} flags - evaluation flags. See Interpreter.SCRIPT_* constants

View File

@ -24,7 +24,7 @@ var JSUtil = require('../util/js');
* See https://en.bitcoin.it/wiki/Script
*
* @constructor
* @param {Object|string|Buffer} [from] optional data to populate script
* @param {Object|string|Buffer=} from optional data to populate script
*/
var Script = function Script(from) {
if (!(this instanceof Script)) {
@ -540,7 +540,7 @@ Script.prototype.removeCodeseparators = function() {
* requiring m of those public keys to spend
* @param {PublicKey[]} publicKeys - list of all public keys controlling the output
* @param {number} threshold - amount of required signatures to spend the output
* @param {Object} [opts] - Several options:
* @param {Object=} opts - Several options:
* - noSorting: defaults to false, if true, don't sort the given
* public keys before creating the script
*/
@ -712,7 +712,7 @@ Script.fromAddress = function(address) {
};
/**
* @param {Network} [network]
* @param {Network=} network
* @return {Address} the associated address for this script
*/
Script.prototype.toAddress = function(network) {

View File

@ -26,7 +26,7 @@ var JSUtil = require('./util/js');
* ```
*
* @param {string|Object} data - A bitcoin URI string or an Object
* @param {Array.<string>} [knownParams] - Required non-standard params
* @param {Array.<string>=} knownParams - Required non-standard params
* @throws {TypeError} Invalid bitcoin address
* @throws {TypeError} Invalid amount
* @throws {Error} Unknown required argument
@ -92,7 +92,7 @@ URI.fromJSON = function fromJSON(json) {
* ```
*
* @param {string|Object} data - A bitcoin URI string or an Object
* @param {Array.<string>} [knownParams] - Required non-standard params
* @param {Array.<string>=} knownParams - Required non-standard params
* @returns {boolean} Result of uri validation
*/
URI.isValid = function(arg, knownParams) {