Comparing version 0.4.29 to 0.4.30
@@ -61,2 +61,7 @@ /* | ||
var adr = new ipv6.Address(ad); | ||
if (adr.error) { | ||
throw new Error('Invalid IPv6: ' + ad); | ||
} | ||
return bigIntToByteArray(adr.bigInteger(), 16); | ||
@@ -63,0 +68,0 @@ } else { |
@@ -293,3 +293,5 @@ /* | ||
l, | ||
r; | ||
r, | ||
blacklisted; | ||
ipVersion = net.isIP(value); | ||
@@ -301,3 +303,11 @@ if (!ipVersion) { | ||
for (i = 0; i < ipBlacklist[ipVersion].length; i = i + 1) { | ||
if (ipBlacklist[ipVersion][i].isInCIDR(value)) { | ||
try { | ||
blacklisted = ipBlacklist[ipVersion][i].isInCIDR(value); | ||
} | ||
catch (e) { | ||
callback(e.message); | ||
return; | ||
} | ||
if (blacklisted) { | ||
callback('IP is blacklisted'); | ||
@@ -1286,6 +1296,6 @@ return; | ||
if (value.toString().match(/^0$|^false$/i)) { | ||
callback(null, 0); | ||
callback(null, false); | ||
} | ||
else if(value.toString().match(/^1$|^true$/i)) { | ||
callback(null, 1); | ||
callback(null, true); | ||
} | ||
@@ -1292,0 +1302,0 @@ else { |
@@ -14,3 +14,3 @@ { | ||
"description": "Serilization and Validation Framework for objects in RESTful APIs", | ||
"version": "0.4.29", | ||
"version": "0.4.30", | ||
"homepage": "https://github.com/racker/node-swiz", | ||
@@ -39,3 +39,3 @@ "repository": { | ||
"devDependencies": { | ||
"whiskey": "0.4.1" | ||
"whiskey": "0.6.6" | ||
}, | ||
@@ -42,0 +42,0 @@ "licenses": [ |
@@ -351,3 +351,3 @@ /* | ||
v.check(neg, function(err, cleaned) { | ||
assert.deepEqual(err.message, 'Invalid IP', 'IP test (negative case 2)'); | ||
assert.match(err.message, /Invalid IPv6/, 'IP test (negative case 2)'); | ||
}); | ||
@@ -1830,3 +1830,2 @@ | ||
function(err, xml) { | ||
console.error(xml); | ||
assert.ifError(err); | ||
@@ -1833,0 +1832,0 @@ sw.deserialize(swiz.SERIALIZATION.SERIALIZATION_XML, 1, xml, function(err, newObj) { |
176040
5230