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

Update dependencies and require Node.js 8 #28

Merged
merged 2 commits into from Oct 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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;
silverwind marked this conversation as resolved.
Show resolved Hide resolved
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"
}
}