T-Validator
Wrapper over validator.js library that provides you easy way to use it with Typescript classes.
Usage
Create your class and put some validation annotations on its properties you want to validate:
; ; ;post.title = 'Hello'; // should not passpost.text = 'this is a great post about hell world'; // should not passpost.rating = 11; // should not passpost.email = 'google.com'; // should not passpost.site = 'googlecom'; // should not pass console.logvalidator.validatePost, post; // returns you array of errors for fields that didn't pass validation
Validator also supports validation groups.
Take a look on samples in ./sample
for more examples of usages.
Todos
- cover with tests
- more documentation and samples
- add support to load validation configuration from json and plain javascript objects
- add support to work with vanila js