docs: use optional instead of nullable

This commit is contained in:
Kagami Hiiragi 2015-02-10 21:23:20 +03:00
parent a9a21fe480
commit 5c981309df
9 changed files with 22 additions and 25 deletions

View File

@ -30,7 +30,7 @@ var popkey = require("./_util").popkey;
/**
* Create a new Bitmessage address object.
* @param {?Object} opts - Address options
* @param {Object=} opts - Address options
* @param {number} opts.version - Version number (4 by default)
* @param {number} opts.stream - Stream number (1 by default)
* @param {Object} opts.behavior - [Pubkey features]{@link module:bitmessage/structs.PubkeyBitfield} (`DOES_ACK` by default)
@ -248,7 +248,7 @@ Address.prototype.encode = function() {
/**
* Create a new Bitmessage address with random encryption and signing
* private keys.
* @param {?Object} opts - Address options
* @param {Object=} opts - Address options
* @param {number} opts.ripeLength - Required length of the short RIPEMD
* hash (19 by default)
* @param {number} opts.version - Version number (4 by default)
@ -287,11 +287,11 @@ Address.fromRandom = function(opts) {
* Create a new Bitmessage address from passphrase.
* @param {(string|Object)} opts - Passphrase or address options
* @param {string} opts.passphrase - Passphrase to generate address from
* @param {?number} opts.ripeLength - Required length of the short
* @param {number=} opts.ripeLength - Required length of the short
* RIPEMD hash (19 by default)
* @param {?number} opts.version - Version number (4 by default)
* @param {?number} opts.stream - Stream number (1 by default)
* @param {?Object} opts.behavior - [Pubkey features]{@link module:bitmessage/structs.PubkeyBitfield} (`DOES_ACK` by default)
* @param {number=} opts.version - Version number (4 by default)
* @param {number=} opts.stream - Stream number (1 by default)
* @param {Object=} opts.behavior - [Pubkey features]{@link module:bitmessage/structs.PubkeyBitfield} (`DOES_ACK` by default)
* @return {Address} New address object.
*/
Address.fromPassphrase = function(opts) {

View File

@ -63,7 +63,7 @@ BaseTransport.prototype.listen = function() {
* Send [message]{@link module:bitmessage/structs.message} over the
* wire (client mode only).
* @param {(Buffer|string)} msg - Encoded message or command string
* @param {?Buffer} payload - Message payload (used if the first
* @param {Buffer=} payload - Message payload (used if the first
* argument is a string)
* @abstract
*/
@ -75,7 +75,7 @@ BaseTransport.prototype.send = function() {
* Send [message]{@link module:bitmessage/structs.message} to all
* connected clients (server mode only).
* @param {(Buffer|string)} msg - Encoded message or command string
* @param {?Buffer} payload - Message payload (used if the first
* @param {Buffer=} payload - Message payload (used if the first
* argument is a string)
* @abstract
*/

View File

@ -24,7 +24,7 @@ var unmap = BaseTransport._unmap;
/**
* TCP transport class. Implements
* [base transport interface]{@link module:bitmessage/net/base.BaseTransport}.
* @param {?Object} opts - Transport options
* @param {Object=} opts - Transport options
* @param {Array} opts.seeds - Bootstrap nodes (none by default)
* @param {Array} opts.dnsSeeds - Bootstrap DNS nodes (none by default)
* @param {Object} opts.services -

View File

@ -1 +0,0 @@
throw new Error("Not implemented");

View File

@ -1 +0,0 @@
throw new Error("Not implemented");

View File

@ -25,7 +25,7 @@ var unmap = BaseTransport._unmap;
/**
* WebSocket transport class. Implements
* [base transport interface]{@link module:bitmessage/net/base.BaseTransport}.
* @param {?Object} opts - Transport options
* @param {Object=} opts - Transport options
* @param {Array} opts.seeds - Bootstrap nodes (none by default)
* @param {Object} opts.services -
* [Service features]{@link module:bitmessage/structs.ServicesBitfield}

View File

@ -104,7 +104,7 @@ var getpubkey = exports.getpubkey = {
/**
* Decode `getpubkey` object message.
* @param {Buffer} buf - Message
* @param {?Object} opts - Decoding options
* @param {Object=} opts - Decoding options
* @return {Promise.<Object>} A promise that contains decoded
* `getpubkey` object structure when fulfilled.
*/
@ -119,7 +119,7 @@ var getpubkey = exports.getpubkey = {
/**
* Decode `getpubkey` object message payload.
* @param {Buffer} buf - Message payload
* @param {?Object} opts - Decoding options
* @param {Object=} opts - Decoding options
* @return {Promise.<Object>} A promise that contains decoded
* `getpubkey` object structure when fulfilled.
*/
@ -245,7 +245,7 @@ var pubkey = exports.pubkey = {
/**
* Decode `pubkey` object message.
* @param {Buffer} buf - Message
* @param {?Object} opts - Decoding options
* @param {Object=} opts - Decoding options
* @return {Promise.<Object>} A promise that contains decoded `pubkey`
* object structure when fulfilled.
*/
@ -260,7 +260,7 @@ var pubkey = exports.pubkey = {
/**
* Decode `pubkey` object message payload.
* @param {Buffer} buf - Message payload
* @param {?Object} opts - Decoding options
* @param {Object=} opts - Decoding options
* @return {Promise.<Object>} A promise that contains decoded `pubkey`
* object structure when fulfilled.
*/

View File

@ -247,7 +247,7 @@ var object = exports.object = {
* Decode `object` message.
* NOTE: `nonce` and `objectPayload` are copied.
* @param {Buffer} buf - Message
* @param {?Object} opts - Decoding options
* @param {Object=} opts - Decoding options
* @return {Object} Decoded `object` structure.
*/
decode: function(buf, opts) {
@ -260,7 +260,7 @@ var object = exports.object = {
* Decode `object` message payload.
* NOTE: `nonce` and `objectPayload` are copied.
* @param {Buffer} buf - Message payload
* @param {?Object} opts - Decoding options
* @param {Object=} opts - Decoding options
* @return {Object} Decoded `object` structure.
*/
decodePayload: function(buf, opts) {
@ -639,7 +639,7 @@ exports.net_addr = {
/**
* Decode `net_addr`.
* @param {Buffer} buf - A buffer that contains encoded `net_addr`
* @param {?Object} opts - Decoding options; use `short` option to
* @param {Object=} opts - Decoding options; use `short` option to
* decode `net_addr` from
* [version message]{@link module:bitmessage/messages.version}
* @return {Object} Decoded `net_addr` structure.
@ -803,9 +803,9 @@ var Bitfield = function(size) {
/**
* Service features bitfield (MSB 0).
* @see {@link https://bitmessage.org/wiki/Protocol_specification#version}
* @param {?Buffer} buf - A 8-byte bitfield buffer (will be created if
* @param {Buffer=} buf - A 8-byte bitfield buffer (will be created if
* not provided or will be copied if `opts.copy` is `true`)
* @param {?Object} opts - Options
* @param {Object=} opts - Options
* @constructor
* @static
* @example
@ -846,9 +846,9 @@ var ServicesBitfield = exports.ServicesBitfield = objectAssign(Bitfield(64), {
/**
* Pubkey features bitfield (MSB 0).
* @see {@link https://bitmessage.org/wiki/Protocol_specification#Pubkey_bitfield_features}
* @param {?Buffer} buf - A 4-byte bitfield buffer (will be created if
* @param {Buffer=} buf - A 4-byte bitfield buffer (will be created if
* not provided or will be copied if `opts.copy` is `true`)
* @param {?Object} opts - Options
* @param {Object=} opts - Options
* @constructor
* @example
* var PubkeyBitfield = require("bitmessage").structs.PubkeyBitfield;

View File

@ -6,8 +6,7 @@
"browser": {
"./lib/platform.js": "./lib/platform.browser.js",
"./lib/net/tcp.js": "./lib/net/tcp.browser.js",
"./lib/net/ws.js": "./lib/net/ws.browser.js",
"./lib/net/webrtc.js": "./lib/net/webrtc.browser.js"
"./lib/net/ws.js": "./lib/net/ws.browser.js"
},
"scripts": {
"install": "node-gyp rebuild || exit 0",