The attributes must be a plain object or a form element, things like backbone models etc are not supported.
For the format of the constraints see the constraints section.
One core value of this library is that nothing should be private or inaccessable.
If you want to modify which values are considered empty for example you can simply overwrite You can find some basic examples included in the project.
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.
This allows you to define a better way of catching validation errors.
This differs from example Ruby on Rails where validators instead have the option.
I find it quite common that you want to have constraints on an optional attribute.
The native HTML form validate has been disabled in a demo purpose so that you may see how works in action.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.You can use the async validate function even if no validations are async, it still returns a promise.You can not, however, use the regular function with async validations.