Created
August 10, 2012 12:54
-
-
Save ovaillancourt/3313976 to your computer and use it in GitHub Desktop.
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 purity = require('virtue-purity'); //virtue's validation | |
//& sanitization lib. | |
var user = { | |
name : [ purity.isString ], //Simple validation that the | |
//name is a string. | |
email : [ purity.trim, purity.isString, purity.isEmail ], | |
age : [ purity.isNumber, purity.greater(0), purity.toInt ], | |
//Array of pets | |
pets : [{ | |
nickname: [purity.isString] | |
}], | |
comments : [], //Free-form field, anything can go in there. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment