Skip to content

Commit

Permalink
fixed bug validator with null values evaluating regexes
Browse files Browse the repository at this point in the history
  • Loading branch information
masylum committed Jan 2, 2011
1 parent 0c34b3d commit 01e671d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/validator.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ module.exports = function (model, data) {


validator.validateRegex = function (validations) { validator.validateRegex = function (validations) {
getKeys(validations).forEach(function (key, i) { getKeys(validations).forEach(function (key, i) {
if (!this.data[key].match(validations[key][0])) { if (!this.data[key] || !this.data[key].match(validations[key][0])) {
this.addError(key, validations[key][1]); this.addError(key, validations[key][1]);
} }
}, this); }, this);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
{ {
"name": "mongolia", "name": "mongolia",
"description": "Mongodb driver wrapper. Acts as model.", "description": "Mongodb driver wrapper. Acts as model.",
"version": "0.0.8", "version": "0.0.9",
"author": "Pau Ramon <masylum@gmail.com>", "author": "Pau Ramon <masylum@gmail.com>",
"keywords": ["mongo", "mongodb", "orm", "database", "db"], "keywords": ["mongo", "mongodb", "orm", "database", "db"],
"main": "./index", "main": "./index",
Expand Down

0 comments on commit 01e671d

Please sign in to comment.