From fb976f25f456ff9e7001b230ccf373365f3d0174 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 15 Oct 2019 19:29:31 +0200 Subject: [PATCH] Update dependencies - default-gateway@5 requires node 8 and brings various minor fixes - removed module.exports.default as mentioned in the TODO - fixed linting issues --- index.js | 13 +++++++------ package.json | 12 ++++++------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/index.js b/index.js index 59d630c..5ade8da 100644 --- a/index.js +++ b/index.js @@ -25,17 +25,20 @@ function findIp(gateway) { return ip; } -function promise(family) { - return defaultGateway[family]().then(result => { +async function promise(family) { + try { + const result = await defaultGateway[family](); return findIp(result.gateway) || null; - }).catch(() => null); + } catch (error) { // eslint-disable-line no-unused-vars + return null; + } } function sync(family) { try { const result = defaultGateway[family].sync(); return findIp(result.gateway) || null; - } catch (error) { + } catch (error) { // eslint-disable-line no-unused-vars return null; } } @@ -47,5 +50,3 @@ internalIp.v6.sync = () => sync('v6'); internalIp.v4.sync = () => sync('v4'); module.exports = internalIp; -// TODO: Remove this for the next major release -module.exports.default = internalIp; diff --git a/package.json b/package.json index d79f4f2..ea6141a 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "url": "sindresorhus.com" }, "engines": { - "node": ">=6" + "node": ">=8.9.4" }, "scripts": { "test": "xo && ava && tsd" @@ -32,12 +32,12 @@ "gateway" ], "dependencies": { - "default-gateway": "^4.2.0", - "ipaddr.js": "^1.9.0" + "default-gateway": "^5.0.4", + "ipaddr.js": "^1.9.1" }, "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" + "ava": "^2.4.0", + "tsd": "^0.9.0", + "xo": "^0.25.3" } }