The goal of is to provide a cross framework and cross language way of validating data.
The validation constraints can be declared in JSON and shared between clients and the server. One thing that is a bit unorthodox is that most validators will consider undefined values (,) valid values.
For the format of the constraints see the constraints section.
If the attributes objects is an HTML/DOM/j Query element Even though none of the built in validators are async it is sometimes useful to have async validations.
One example would be to check if a username is already used by asking the server.
supports async validations through the returns a Promise that is resolved if the validation passes and is rejected if the validation failed, passing the errors as the first argument.
It is unit tested with 100% code coverage and can be considered fit for production.
Besides accepting all options as the non async validation function it also accepts two additional options; clean Attributes which, unless before resolving the promise and wrap Errors which can be a function or constructor that will be called with the errors, options, attributes and constraints if an error occurs.I find it quite common that you want to have constraints on an optional attribute.One core value of this library is that nothing should be private or inaccessable.The native HTML form validate has been disabled in a demo purpose so that you may see how works in action.Unless otherwise specified you can always specify the message option to customize the message returned if the validator doesn't pass.