Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkg: fix optional parameters. #13

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions lib/ip.js
Original file line number Diff line number Diff line change
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