Skip to content

Instantly share code, notes, and snippets.

@ovaillancourt
Created September 19, 2012 19:30
Show Gist options
  • Save ovaillancourt/3751706 to your computer and use it in GitHub Desktop.
Save ovaillancourt/3751706 to your computer and use it in GitHub Desktop.
var validation = require( './validation' );
var v = require('./validators' );
function lowerCase( value, err ){
return value.toLowerCase();
}
var userSchema = {
firstname : [ v.trim() ],
lastname : [ v.trim() ],
personal : {
email : [ v.trim(), v.isEmail(), lowerCase ],
age : [ v.toInt(), v.min(0) ]
}
};
var fakeUser = {
firstname : 'Olivier',
lastname: 'Vaillancourt',
personal: {
email: 'Olivier@keatonrow.com ',
age: 5.5
}
};
validation.validate( fakeUser, userSchema );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment