If you have ever worked with Vue.js, Ember or MobX I’m pretty sure you stumbled upon the so-called computed properties. They allow you to create functions that can be accessed just like normal values, but once computed they are cached until one of its dependencies has changed.
The popular approach
There are already good validator libraries dedicated for Vue.js like vue-validator or vee-validate.
Both those libraries work quite similarly in that they require you to write the rules inside the template. Often this is all you actually need for your application. Let’s take a look at this example from vee-validate...
The reactive way
With the growing need for robust and interactive web interfaces, many developers have started embracing the reactive programming paradigm.
Before we begin implementing our own reactive engine, let’s quickly explain what reactive programming actually is. Wikipedia gives us a classic example of a reactive interface implementatio...