external-ip
Advanced tools
Comparing version 0.0.4 to 0.0.5
'use strict'; | ||
var getIP = require('./index'); | ||
var getIP = require('./index').getIP; | ||
@@ -5,0 +5,0 @@ getIP(function (err, ip) { |
@@ -5,3 +5,3 @@ 'use strict'; | ||
module.exports = function (cb) { | ||
module.exports.getIP = function (cb) { | ||
var errors = []; | ||
@@ -14,3 +14,2 @@ utils.asyncLoop({ | ||
err = services[i].url + ' : ' + err; | ||
console.log(err); | ||
errors.push(err); | ||
@@ -17,0 +16,0 @@ next(); |
{ | ||
"name": "external-ip", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Get your external IP, with fallbacks", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -22,3 +22,3 @@ #external-ip | ||
```javascript | ||
var getIP = require('external-ip'); | ||
var getIP = require('external-ip').getIP; | ||
@@ -25,0 +25,0 @@ getIP(function (err, ip) { |
@@ -1,1 +0,19 @@ | ||
'use strict'; | ||
'use strict'; | ||
/*globals it, describe*/ | ||
// Integration test | ||
var getIP = require('../index').getIP; | ||
var utils = require('../lib/utils'); | ||
var should = require('should'); | ||
describe('index.js test', function () { | ||
it('Should return an IP', function (done) { | ||
this.timeout(3000); | ||
getIP(function (err, ip) { | ||
(err === null).should.be.true; | ||
utils.isIP(ip).should.be.true; | ||
done(); | ||
}); | ||
}); | ||
}); |
@@ -1,1 +0,63 @@ | ||
'use strict'; | ||
'use strict'; | ||
/*globals describe, it*/ | ||
var utils = require('../lib/utils'); | ||
var sould = require('should'); | ||
describe('utils.js test', function () { | ||
it('should be able to validate IPv4, IPv6 and hostnames', function () { | ||
utils.isIP('192.168.1.1').should.be.true; | ||
utils.isIP('94.65.128.173').should.be.true; | ||
utils.isIP('FE80:0000:0000:0000:0202:B3FF:FE1E:8329').should.be.true; | ||
utils.isIP('FE80::0202:B3FF:FE1E:8329').should.be.true; | ||
utils.isIP('batman.local').should.be.true; | ||
utils.isIP(111111).should.be.false; | ||
utils.isIP('192..1.1').should.be.false; | ||
utils.isIP('94.65.128.1A3').should.be.false; | ||
utils.isIP('FE80:0000:0000:0000:0202:B3FF:FE1E:').should.be.false; | ||
}); | ||
it('should loop i times and pass the arguments to done callback', function(cb) { | ||
var i = 10; | ||
utils.asyncLoop({ | ||
iterations: i, | ||
exec: function (i, stop, next) { | ||
next(i, 'man'); | ||
}, | ||
done: function (result, bat) { | ||
result.should.equal(i-1); | ||
bat.should.equal('man'); | ||
cb(); | ||
} | ||
}); | ||
}); | ||
it('should loop i times and stop at n and pass the arguments to done callback', function(cb) { | ||
var i = 10; | ||
var n = 4; | ||
utils.asyncLoop({ | ||
iterations: i, | ||
exec: function (i, stop, next) { | ||
if(i === n) { | ||
stop(i, 'tab'); | ||
} | ||
next(i, 'man'); | ||
}, | ||
done: function (result, bat) { | ||
result.should.equal(n); | ||
bat.should.equal('tab'); | ||
cb(); | ||
} | ||
}); | ||
}); | ||
}); |
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
11635
271