Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ipv4

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipv4 - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

34

lib/ipv4.js

@@ -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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc