Skip to content

Commit

Permalink
pkg: fix optional parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
nodech committed Sep 19, 2023
1 parent 50c00f9 commit e25e54d
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions lib/ip.js
Expand Up @@ -415,8 +415,8 @@ binet.toHost = function toHost(host, port, key) {
/**
* Parse a hostname.
* @param {String} addr
* @param {Number?} fport - Fallback port.
* @param {Buffer?} fkey - Fallback key.
* @param {Number} [fport=0] - Fallback port.
* @param {Buffer} [fkey=null] - Fallback key.
* @returns {Object} Contains `host`, `port`, and `type`.
*/

Expand Down Expand Up @@ -828,7 +828,7 @@ binet.isEqual = function isEqual(a, b) {
* Apply a network mask to IP.
* @param {Buffer} raw
* @param {Buffer} mask
* @param {Buffer?} dst
* @param {Buffer} [dst]
* @returns {Buffer}
*/

Expand Down Expand Up @@ -859,7 +859,7 @@ binet.mask = function(raw, mask, dst) {
* to IP from CIDR bits.
* @param {Buffer} raw
* @param {Number} bits
* @param {Buffer?} dst
* @param {Buffer} [dst]
* @returns {Buffer}
*/

Expand Down Expand Up @@ -1477,7 +1477,7 @@ binet._interfaces = function _interfaces(filter, af) {

/**
* Get local IP from network interfaces.
* @param {String?} family - IP family name.
* @param {String} [family='all'] - IP family name.
* @returns {String[]}
*/

Expand All @@ -1487,7 +1487,7 @@ binet.getInterfaces = function getInterfaces(family) {

/**
* Get local IP from network interfaces.
* @param {String?} family - IP family name.
* @param {String} [family='all'] - IP family name.
* @returns {String[]}
*/

Expand All @@ -1497,7 +1497,7 @@ binet.getLocal = function getLocal(family) {

/**
* Get non-local IP from network interfaces.
* @param {String?} family - IP family name.
* @param {String} [family='all'] - IP family name.
* @returns {String[]}
*/

Expand All @@ -1507,7 +1507,7 @@ binet.getNonlocal = function getNonlocal(family) {

/**
* Get private IP from network interfaces.
* @param {String?} family - IP family name.
* @param {String} [family='all'] - IP family name.
* @returns {String[]}
*/

Expand All @@ -1517,7 +1517,7 @@ binet.getPrivate = function getPrivate(family) {

/**
* Get public IP from network interfaces.
* @param {String?} family - IP family name.
* @param {String} [family='all'] - IP family name.
* @returns {String[]}
*/

Expand Down Expand Up @@ -1557,6 +1557,11 @@ function af2str(af) {
throw new Error(`Invalid address family: ${af}.`);
}

/**
* @param {*} family
* @returns {types}
*/

function str2af(family) {
if (family == null)
return types.NONE;
Expand Down

0 comments on commit e25e54d

Please sign in to comment.