Comparing version 1.0.1 to 1.0.2
18
index.js
@@ -698,12 +698,16 @@ /** | ||
if (value.length > 255) return false; | ||
var names = value.split('.'); | ||
if (!is.array(names) || !names.length) return false; | ||
if (names[0].indexOf('_') > -1) return false; | ||
for (var i=0; i<names.length; i++) { | ||
if (!dnsLabel.test(names[i])) return false; | ||
} | ||
if (numbersLabel.test(value)) return false; | ||
if (!dnsLabel.test(value)) return false; | ||
return true; | ||
//var names = value.split('.'); | ||
//if (!is.array(names) || !names.length) return false; | ||
//if (names[0].indexOf('_') > -1) return false; | ||
//for (var i=0; i<names.length; i++) { | ||
//if (!dnsLabel.test(names[i])) return false; | ||
//} | ||
//return true; | ||
}; | ||
is.dnsAddr = is.dns = is.dnsAddress; | ||
var dnsLabel = /^(?![0-9]+$)(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$/; | ||
var dnsLabel = /^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$/; | ||
var numbersLabel = /^([0-9]|[0-9][0-9\-]{0,61}[0-9])(\.([0-9]|[0-9][0-9\-]{0,61}[0-9]))*$/; | ||
@@ -710,0 +714,0 @@ /** |
{ | ||
"name": "is2", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A type checking library where each exported function returns either true or false and does not throw. Also added tests.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
30
tests.js
@@ -913,5 +913,6 @@ 'use strict'; | ||
assert.equal(true, is.dns('stdarg')); | ||
assert.equal(true, is.dns('stdarg.com')); | ||
assert.equal(true, is.dns('www.stdarg.com')); | ||
//assert.equal(false, is.dns('336.332')); | ||
assert.equal(false, is.dns('336.332')); | ||
assert.equal(true, is.dns('3stdarg.com')); | ||
@@ -1291,3 +1292,6 @@ assert.equal(false, is.dns('192.168.0.2000000000')); | ||
it('should return true for valid uuids ', function() { | ||
assert.equal(false, is.uuid()); | ||
assert.equal(false, is.uuid(null)); | ||
assert.equal(false, is.uuid(-1)); | ||
assert.equal(false, is.uuid(-1)); | ||
assert.equal(false, is.uuid(false)); | ||
@@ -1311,1 +1315,25 @@ assert.equal(false, is.uuid('3678363')); | ||
}); | ||
describe('is.hostAddress', function() { | ||
it('should return true for valid uuids ', function() { | ||
assert.equal(false, is.hostAddress()); | ||
assert.equal(false, is.hostAddress(null)); | ||
assert.equal(false, is.hostAddress(-1)); | ||
assert.equal(false, is.hostAddress(-1)); | ||
assert.equal(false, is.hostAddress(false)); | ||
assert.equal(false, is.hostAddress('3678363')); | ||
assert.equal(false, is.hostAddress({})); | ||
assert.equal(false, is.hostAddress([])); | ||
assert.equal(false, is.hostAddress(6011090018648076)); | ||
assert.equal(false, is.hostAddress('1000000.10.1.1')); | ||
assert.equal(true, is.hostAddress('192.168.1.1')); | ||
assert.equal(true, is.hostAddress('10.10.1.1')); | ||
assert.equal(true, is.hostAddress('www.google.com')); | ||
assert.equal(true, is.hostAddress('finance.yahoo.com')); | ||
assert.equal(true, is.hostAddress('google.com')); | ||
assert.equal(true, is.hostAddress('google')); | ||
assert.equal(true, is.hostAddress('close5-dev.5fxjas.0001.usw1.cache.amazonaws.com')); | ||
}); | ||
}); | ||
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
105692
2251