From 5c981309df2170368a888b60d5123a03866a7bb5 Mon Sep 17 00:00:00 2001 From: Kagami Hiiragi Date: Tue, 10 Feb 2015 21:23:20 +0300 Subject: [PATCH] docs: use optional instead of nullable --- lib/address.js | 12 ++++++------ lib/net/base.js | 4 ++-- lib/net/tcp.js | 2 +- lib/net/webrtc.browser.js | 1 - lib/net/webrtc.js | 1 - lib/net/ws.js | 2 +- lib/objects.js | 8 ++++---- lib/structs.js | 14 +++++++------- package.json | 3 +-- 9 files changed, 22 insertions(+), 25 deletions(-) delete mode 100644 lib/net/webrtc.browser.js delete mode 100644 lib/net/webrtc.js diff --git a/lib/address.js b/lib/address.js index 25fcfb1..a1c85c1 100644 --- a/lib/address.js +++ b/lib/address.js @@ -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) { diff --git a/lib/net/base.js b/lib/net/base.js index ea934b1..c21310c 100644 --- a/lib/net/base.js +++ b/lib/net/base.js @@ -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 */ diff --git a/lib/net/tcp.js b/lib/net/tcp.js index 452d43a..43caeda 100644 --- a/lib/net/tcp.js +++ b/lib/net/tcp.js @@ -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 - diff --git a/lib/net/webrtc.browser.js b/lib/net/webrtc.browser.js deleted file mode 100644 index 3e631c2..0000000 --- a/lib/net/webrtc.browser.js +++ /dev/null @@ -1 +0,0 @@ -throw new Error("Not implemented"); diff --git a/lib/net/webrtc.js b/lib/net/webrtc.js deleted file mode 100644 index 3e631c2..0000000 --- a/lib/net/webrtc.js +++ /dev/null @@ -1 +0,0 @@ -throw new Error("Not implemented"); diff --git a/lib/net/ws.js b/lib/net/ws.js index 7490580..df44115 100644 --- a/lib/net/ws.js +++ b/lib/net/ws.js @@ -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} diff --git a/lib/objects.js b/lib/objects.js index 1943dfc..675056d 100644 --- a/lib/objects.js +++ b/lib/objects.js @@ -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.} 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.} 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.} 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.} A promise that contains decoded `pubkey` * object structure when fulfilled. */ diff --git a/lib/structs.js b/lib/structs.js index ee860e4..4ccf4ae 100644 --- a/lib/structs.js +++ b/lib/structs.js @@ -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; diff --git a/package.json b/package.json index cd7ed23..1cb179a 100644 --- a/package.json +++ b/package.json @@ -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",