Last active
August 29, 2015 14:27
-
-
Save umayr/652a6cadead7f2cdfdf0 to your computer and use it in GitHub Desktop.
API for validating a complete object via uranus.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Uranus = require('uranus'); | |
var validator = new Uranus(); | |
var obj = { | |
firstName: 'umayr', | |
lastName: 'shahid', | |
email: '[email protected]' | |
}; | |
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