README
lx-valid
A JSON schema validator for Node.js/io.js and the client, based on Flatiron Revalidator.
The idea
Nodejitsu's Revalidator is a great JSON schema validator and therefore the backbone of lx-valid. But in practice there is often a need for a more general validator for simple checks that works on the client as well as on the server. The basic concept is to extend Revalidator and create a more complete validation framework that allows for simple checks without the need of defining a JSON schema and that also supports string filtering and data type conversion.
An example
Since lx-valid's core is based on Revalidator, lx-valid is fully compatible to the latter. You can find more information about Revalidator here: https://github.com/flatiron/revalidator. The Revalidator example showing schema validation works exactly the same with lx-valid:
var val = require('lx-valid'),
someObject = {
url: 'http://www.litixsoft.de',
mission: 'change the world',
body: 'Chuck Norris'
},
schema = {
properties: {
url: {
description: 'Company url',
type: 'string',
pattern: '^/[^#%&*{}\\:<>?\/+]+