Comparing version 0.0.3 to 0.0.4
@@ -14,26 +14,18 @@ /* ================================================================ | ||
"use strict"; | ||
'use strict'; | ||
var os = require('os'); | ||
var util = require('xutil'); | ||
var network = require('os').networkInterfaces() | ||
/** | ||
* get ipv4 | ||
*/ | ||
for (var n in network) { | ||
var ipv4 = network[n].filter(function(i) { | ||
return i.family === 'IPv4' && !i.internal | ||
}) | ||
function getIpv4() { | ||
var networkInterfaces = os.networkInterfaces(); | ||
var ipv4 = null; | ||
util.each(networkInterfaces,function(networkInterface){ | ||
networkInterface.forEach(function (network) { | ||
if (network.family === 'IPv4' && !network.internal) { | ||
ipv4 = network.address; | ||
return; | ||
} | ||
}); | ||
}); | ||
return ipv4; | ||
}; | ||
if (ipv4.length) { | ||
module.exports = ipv4[0].address | ||
return | ||
} | ||
} | ||
module.exports = getIpv4(); | ||
// Fallback | ||
module.exports = '0.0.0.0' |
{ | ||
"name": "ipv4", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "ipv4", | ||
@@ -13,5 +13,2 @@ "bin": { | ||
}, | ||
"dependencies": { | ||
"xutil":"0.0.2" | ||
}, | ||
"keywords": ["ip","ipv4"], | ||
@@ -18,0 +15,0 @@ "devDependencies": { |
@@ -15,3 +15,4 @@ ipv4 | ||
```bash | ||
$ ipv4 xdf | ||
$ ipv4 | ||
$ Your ip is: 192.168.1.101 which was in your clipboard. | ||
``` | ||
@@ -18,0 +19,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
0
41
5516
42
- Removedxutil@0.0.2
- Removedxutil@0.0.2(transitive)