modm
Advanced tools
Comparing version 0.1.8 to 0.1.9
@@ -24,6 +24,8 @@ // INFO: results of atomic operations are not validated. | ||
maxLength: function (length, value) { | ||
if (value.length) { | ||
return value.length <= length ? true : false; | ||
if (value.length && value.length <= length) { | ||
return [null, value]; | ||
} | ||
return ['Validation maxLength failed']; | ||
}, | ||
@@ -33,5 +35,7 @@ | ||
if (value.length) { | ||
return value.length >= length ? true : false; | ||
if (value.length && value.length >= length) { | ||
return [null, value]; | ||
} | ||
return ['Validation minLength failed']; | ||
}, | ||
@@ -41,12 +45,15 @@ | ||
if (typeof value === 'number') { | ||
return value <= optValue ? true : false; | ||
if (typeof value === 'number' && value <= optValue) { | ||
return [null, value]; | ||
} | ||
return ['Validation max failed']; | ||
}, | ||
min: function (optValue, value) { | ||
if (typeof value === 'number') { | ||
return value >= optValue ? true : false; | ||
if (typeof value === 'number' && value >= optValue) { | ||
return [null, value]; | ||
} | ||
return false; | ||
return ['Validation min failed']; | ||
}, | ||
@@ -53,0 +60,0 @@ } |
{ | ||
"name": "modm", | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"author": "Adrian Ottiker <adrian@ottiker.com>", | ||
@@ -5,0 +5,0 @@ "description": "A MongoDB Object Document Mapper (ODM)", |
34043
839