Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update dependencies and require Node.js 8 (#28)
  • Loading branch information
silverwind authored and sindresorhus committed Oct 16, 2019
1 parent 5491cbc commit 15425f1
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,5 +1,5 @@
language: node_js
node_js:
- '12'
- '10'
- '8'
- '6'
3 changes: 0 additions & 3 deletions index.d.ts
Expand Up @@ -45,9 +45,6 @@ interface v4 {
declare const internalIp: {
v6: v6;
v4: v4;

// TODO: Remove this for the next major release
default: typeof internalIp;
};

export = internalIp;
13 changes: 7 additions & 6 deletions index.js
Expand Up @@ -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 (_) {
return null;
}
}

function sync(family) {
try {
const result = defaultGateway[family].sync();
return findIp(result.gateway) || null;
} catch (error) {
} catch (_) {
return null;
}
}
Expand All @@ -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;
12 changes: 6 additions & 6 deletions package.json
Expand Up @@ -10,7 +10,7 @@
"url": "sindresorhus.com"
},
"engines": {
"node": ">=6"
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd"
Expand All @@ -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"
}
}

0 comments on commit 15425f1

Please sign in to comment.