common-errors
Advanced tools
Comparing version
@@ -5,3 +5,3 @@ { | ||
"description": "Common error classes and utility functions", | ||
"version": "0.4.16", | ||
"version": "0.4.17", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
@@ -532,5 +532,5 @@ common-errors | ||
function validateUsername(username){ | ||
var errors = []; | ||
if(username.length < 3) errors.push(new errors.ValidationError("username must be at least two characters long", "VAL_MIN_USERNAME_LENGTH", "username")); | ||
if(/-%$*&!/.test(username)) errors.push(new errors.ValidationError("username may not contain special characters", "VAL_USERNAME_SPECIALCHARS", "username")); | ||
var errors = new errors.ValidationError(); | ||
if(username.length < 3) errors.addError(new errors.ValidationError("username must be at least two characters long", "VAL_MIN_USERNAME_LENGTH", "username")); | ||
if(/-%$*&!/.test(username)) errors.addError(new errors.ValidationError("username may not contain special characters", "VAL_USERNAME_SPECIALCHARS", "username")); | ||
return errors; | ||
@@ -537,0 +537,0 @@ } |
63173
0.05%