How do you do data validation?

Just wondering if there are any especially useful practices/resources for data validation.

For instance we use notifications to set data on our models and the way we validate is typically something like

if (this.hasValue(data) && this.hasValue(data.something) { Object.property = data.something; } 

would a better practice be to send the data to each model and handle the validation there? What if you had 2 different models with the same property names.

Trying to find some solutions to some of the programming/maintenance pain points before we start our next project in a few months.

  • this.hasValue is a function that just checks for null or undefined

submitted by /u/BinxyPrime
[link] [comments]
Source: Reddit