A validation plugin for patio models. This plugin adds a validate method to each Model
class that adds it as a plugin. This plugin does not include most typecast checks as patio already checks
types upon column assignment.

To do single col validation

var Model = patio.addModel("validator", {
plugins:[patio.plugins.ValidatorPlugin]
});
//this ensures column assignment
Model.validate("col1").isNotNull().isAlphaNumeric().hasLength(1, 10);
//col2 does not have to be assigned but if it is it must match /hello/ig.
Model.validate("col2").like(/hello/ig);
//Ensures that the emailAddress column is a valid email address.
Model.validate("emailAddress").isEmailAddress();

Or you can do a mass validation through a callback.

var Model = patio.addModel("validator", {
plugins:[patio.plugins.ValidatorPlugin]
});
Model.validate(function(validate){
//this ensures column assignment
validate("col1").isNotNull().isAlphaNumeric().hasLength(1, 10);
//col2 does not have to be assigned but if it is it must match /hello/ig.
validate("col2").isLike(/hello/ig);
//Ensures that the emailAddress column is a valid email address.
validate("emailAddress").isEmail();
});