Validator adapter for letting you use whathever awesome validation lib you want.
Code information:
Package information:
In order to create a validator, extend the executeValidation
method:
var UserValidation = function () {};
UserValidator.prototype = Koine.Validator.prototype;
UserValidator.prototype = Koine.Validator.prototype.executeValidation = function (value) {
if (!value['name']) {
this.getErrors().add('name', 'you must set name');
}
if (!value['lastName']) {
this.getErrors().add('lastName', 'you must set last name');
}
};
var user = { name: 'Jon', lastName: '' };
var validator = new UserValidator();
validator.isValid(user); // false
validator.getErrors();
// { lastName: ['last name cannot be empty'] }
user.lastName = 'Doe';
validator.isValid(user); // true
@TODO
Here is the issue tracker.
Please refer to the contribuiting guide.