Comparing version 1.0.1 to 1.0.2
@@ -0,1 +1,3 @@ | ||
'use strict'; | ||
module.exports = require('./lib/ipv4'); |
'use strict'; | ||
var network = require('os').networkInterfaces(); | ||
for (var n in network) { | ||
var ipv4 = network[n].filter(function(i) { | ||
return i.family === 'IPv4' && !i.internal; | ||
}); | ||
if (ipv4.length) { | ||
module.exports = ipv4[0].address; | ||
return; | ||
} | ||
} | ||
// Fallback | ||
module.exports = '0.0.0.0'; | ||
module.exports = require('address').ip(); |
{ | ||
"name": "ipv4", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "ipv4", | ||
@@ -18,7 +18,11 @@ "bin": { | ||
"devDependencies": { | ||
"mocha": "*" | ||
"mocha": "*", | ||
"validator": "^9.2.0" | ||
}, | ||
"homepage": "https://github.com/xudafeng/ipv4", | ||
"scripts": { | ||
"test": "mocha" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"address": "^1.0.3", | ||
"chalk": "^1.1.3", | ||
@@ -25,0 +29,0 @@ "copy-paste": "^1.3.0" |
@@ -1,19 +0,11 @@ | ||
/* ================================================================ | ||
* ipv4 by xdf(xudafeng[at]126.com) | ||
* | ||
* first created at : Wed Jun 04 2014 12:33:02 GMT+0800 (CST) | ||
* | ||
* ================================================================ | ||
* Copyright 2013 xdf | ||
* | ||
* Licensed under the MIT License | ||
* You may not use this file except in compliance with the License. | ||
* | ||
* ================================================================ */ | ||
'use strict'; | ||
"use strict"; | ||
const ipv4 = require('..'); | ||
const assert = require('assert'); | ||
const validator = require('validator'); | ||
var ipv4 = require('../'); | ||
describe('', function(){ | ||
describe('test', () => { | ||
it('should be ok', () => { | ||
assert(validator.isIP(ipv4), true); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
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
No website
QualityPackage does not have a website.
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
2413
3
2
10
13
1
+ Addedaddress@^1.0.3
+ Addedaddress@1.2.2(transitive)