default-gateway
Advanced tools
Comparing version 6.0.1 to 6.0.2
@@ -6,3 +6,3 @@ "use strict"; | ||
const execa = require("execa"); | ||
const dests = ["default", "0.0.0.0", "0.0.0.0/0", "::", "::/0"]; | ||
const dests = new Set(["default", "0.0.0.0", "0.0.0.0/0", "::", "::/0"]); | ||
@@ -26,3 +26,3 @@ const args = { | ||
const iface = results[family === "v4" ? v4IfaceColumn : 3]; | ||
if (dests.includes(target) && gateway && isIP(gateway)) { | ||
if (dests.has(target) && gateway && isIP(gateway)) { | ||
result = {gateway, interface: (iface ? iface : null)}; | ||
@@ -29,0 +29,0 @@ return true; |
@@ -5,3 +5,3 @@ "use strict"; | ||
const execa = require("execa"); | ||
const dests = ["default", "0.0.0.0", "0.0.0.0/0", "::", "::/0"]; | ||
const dests = new Set(["default", "0.0.0.0", "0.0.0.0/0", "::", "::/0"]); | ||
@@ -18,3 +18,3 @@ const args = { | ||
const [target, gateway, _, iface] = line.split(/ +/) || []; | ||
if (dests.includes(target) && gateway && isIP(gateway)) { | ||
if (dests.has(target) && gateway && isIP(gateway)) { | ||
result = {gateway, interface: (iface ? iface : null)}; | ||
@@ -21,0 +21,0 @@ return true; |
13
index.js
@@ -19,11 +19,8 @@ "use strict"; | ||
if (supportedPlatforms.has(plat)) { | ||
let file; | ||
let file = plat; | ||
if (plat === "aix") { | ||
// AIX `netstat` output is compatible with Solaris | ||
file = `${type() === "OS400" ? "ibmi" : "sunos"}.js`; | ||
} else { | ||
file = `${plat}.js`; | ||
file = type() === "OS400" ? "ibmi" : "sunos"; // AIX `netstat` output is compatible with Solaris | ||
} | ||
const m = require(`./${file}`); | ||
const m = require(`./${file}.js`); | ||
module.exports.v4 = () => m.v4(); | ||
@@ -37,4 +34,4 @@ module.exports.v6 = () => m.v6(); | ||
module.exports.v6 = () => Promise.reject(err); | ||
module.exports.v4.sync = () => {throw err; }; | ||
module.exports.v6.sync = () => {throw err; }; | ||
module.exports.v4.sync = () => { throw err; }; | ||
module.exports.v6.sync = () => { throw err; }; | ||
} |
@@ -5,3 +5,3 @@ "use strict"; | ||
const execa = require("execa"); | ||
const dests = ["default", "0.0.0.0", "0.0.0.0/0", "::", "::/0"]; | ||
const dests = new Set(["default", "0.0.0.0", "0.0.0.0/0", "::", "::/0"]); | ||
@@ -21,3 +21,3 @@ const args = { | ||
const iface = results[7]; | ||
if (dests.includes(target) && gateway && isIP(gateway)) { | ||
if (dests.has(target) && gateway && isIP(gateway)) { | ||
result = {gateway, interface: (iface ? iface : null)}; | ||
@@ -24,0 +24,0 @@ return true; |
{ | ||
"name": "default-gateway", | ||
"version": "6.0.1", | ||
"version": "6.0.2", | ||
"description": "Get the default network gateway, cross-platform.", | ||
"author": "silverwind <me@silverwind.io>", | ||
"author": "silverwind", | ||
"repository": "silverwind/default-gateway", | ||
"license": "BSD-2-Clause", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "make test" | ||
}, | ||
"engines": { | ||
@@ -27,10 +24,10 @@ "node": ">= 10" | ||
"dependencies": { | ||
"execa": "^4.0.2" | ||
"execa": "^4.0.3" | ||
}, | ||
"devDependencies": { | ||
"eslint": "7.1.0", | ||
"eslint-config-silverwind": "13.4.2", | ||
"jest": "26.0.1", | ||
"updates": "10.2.12", | ||
"versions": "8.2.10" | ||
"eslint": "7.7.0", | ||
"eslint-config-silverwind": "18.0.5", | ||
"jest": "26.4.2", | ||
"updates": "10.3.5", | ||
"versions": "8.4.3" | ||
}, | ||
@@ -37,0 +34,0 @@ "keywords": [ |
# default-gateway | ||
[![](https://img.shields.io/npm/v/default-gateway.svg?style=flat)](https://www.npmjs.org/package/default-gateway) [![](https://img.shields.io/npm/dm/default-gateway.svg)](https://www.npmjs.org/package/default-gateway) | ||
> Get the default network gateway, cross-platform. | ||
Obtains the machine's default gateway through `exec` calls to OS routing interfaces. | ||
@@ -16,3 +14,3 @@ | ||
``` | ||
$ npm install default-gateway | ||
$ npm i default-gateway | ||
``` | ||
@@ -19,0 +17,0 @@ |
@@ -5,3 +5,3 @@ "use strict"; | ||
const execa = require("execa"); | ||
const dests = ["default", "0.0.0.0", "0.0.0.0/0", "::", "::/0"]; | ||
const dests = new Set(["default", "0.0.0.0", "0.0.0.0/0", "::", "::/0"]); | ||
@@ -21,3 +21,3 @@ const args = { | ||
const iface = results[5]; | ||
if (dests.includes(target) && gateway && isIP(gateway)) { | ||
if (dests.has(target) && gateway && isIP(gateway)) { | ||
result = {gateway, interface: (iface ? iface : null)}; | ||
@@ -24,0 +24,0 @@ return true; |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
16098
364
1
52
Updatedexeca@^4.0.3