Powerful javascript by schema validation tool
Several quick start options are available:
- Download the latest release
- Clone the repo:
git clone https://github.com/massive-angular/valirator.git
- Install with npm:
npm install valirator --save
- Install with bower:
bower install valirator --save
For documentation please follow: https://massive-angular.github.io/valirator/
import { validate } from 'valirator';
const validationResult = await validate(schema, obj);
const schema = {
Email: {
required: true,
minLength: 3,
maxLength: 50,
},
Password: {
required: true,
minLength: 3,
maxLength: 50,
},
};
const schema = {
Person: {
FirstName: {
required: true,
maxLength: 50,
},
LastName: {
required: true,
maxLength: 50,
},
Email: {
required: true,
format: 'email',
},
},
};
const schema = {
Employees: {
rules: {
required: true,
minItems: 5,
},
properties: {
FirstName: {
required: true,
maxLength: 50,
},
LastName: {
required: true,
maxLength: 50,
},
Email: {
required: true,
format: 'email',
},
},
messages: {
required: 'Please fill %{property}',
},
},
};
Alexandr Dascal
Slava Matvienco
Code released under the MIT license.