Skip to content

Instantly share code, notes, and snippets.

@umayr
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save umayr/652a6cadead7f2cdfdf0 to your computer and use it in GitHub Desktop.
Save umayr/652a6cadead7f2cdfdf0 to your computer and use it in GitHub Desktop.
API for validating a complete object via uranus.
var Uranus = require('uranus');
var validator = new Uranus();
var obj = {
firstName: 'umayr',
lastName: 'shahid',
email: 'umayr.shahid@tenpearls.com'
};
var rules = {
firstName: {
notNull: true,
isAlpha: true,
len: [10, 100]
},
lastName: {
notNull: true,
isAlpha: true,
len: [10, 100]
},
firstName: {
notNull: true,
isEmail: true
}
}
validator.validateAll(obj, rules);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment