-
Notifications
You must be signed in to change notification settings - Fork 4
Home
This is a data validator inspired by https://github.com/yiminghe/async-validator and adapted to VueJS fixing the lack of other data validators and with the following features:
No matter what template library you use, this validator will simply work.
Focused in developer easiness to save time and headaches.
When an object is loaded from server you can set it without worring, it will restore attribute watchers.
If you have multiple data objects to validate this mixin will deal with it without trouble.
If a validation in value fails will not run the rest to validations for the value, reducing time considerably.
Will detect if the resturned validation is a promise and handle properly without need of external packages.
I have found that in some validators the results are showed in the next tick. This mixin forces the render to be updated one the validations are finished so no delays are produced.
If a typing if being validated against a resource it will control the times in order to ensure that the last one is the validation that prevails against the previuos.
It controls whether a validation is performed or not, so if the value does not change it will not be validated again, saving time and processing.
This validator is served as a mixin just with vue as dependency in order to reduce the processing, time and load. It is set out to accomplish most of the use cases so it is adapted to common use needs.
Feel free to contribute or bring suggestions, any improvement will be at least taken in mind, discussed and accepted if reasonable, just keep the the previous rules in mind.