UMD build added
I added UMD build and I updated the doc. It will be possible to use plugin directly inside a web page. It will also be possible via unpkg CDN to create jsfiddle. It will be easier for you to fix bugs.
@devistar thanks very much for your contribution!
I would like to merge the UMD changes, but I afraid I cannot accept the codes that send AJAX request. Cuz there are many different ways and libraries (personally I use vue-resource) to talk to the server for async validation, and I don't think a validation library should make the decision on this. Besides that, I want to have as less dependencies as possible, so that the library is small and clean.
I should have created a new branch for unique rule feature to not polute UMD build feature. But you can pull and rebase I added unique feature after.
What do you think about adding the way to create a custom persistant rule that could be chained ? Custom are good for unique use but a custom persistant rule is better for reusability. Then it would be possible for everyone to create unique rule using vue-resource or axios.
I reset master branch to umd build state. On my project, I added a feature to your library allowing to add global custom validator. I did it by extending object and prototype but it can be easily added to your library.
I can do this :
addRule('unique', function(url, params) {
// Rule context
// Validation code...
return this;
})
Then I chain my global custom validator in my project. For example :
validators: {
username: function(value) {
return Validator.value(value)
.required()
.minLength(5)
.unique('users', { username: value });
}
}
})
It works like a charm. If you are interested, I can add this. But you have to accept my current pull request and the next one.