cross-check / core

A validation library for JavaScript.
Other
4 stars 0 forks source link

Obj validator #6

Closed wycats closed 7 years ago

wycats commented 7 years ago

Adds an object validator.

This PR also adds a number of improvements to the core Validator class:

The most important aspect of this PR is getting more serious about the composition strategy of having validators ignore values that are not in the type they are supposed to be validating. This makes it easier to combine things like presence, numeric, and range, but also mix and match them in different ways (for example, to make a numeric validator + allowBlank).

It's a little bit of a quirky strategy, and I think I want to add a method to the base Validator to make it more obvious what's going on.