0.0.3 • Published 8 years ago
jov v0.0.3
JOV
JOV is a JavaScript module for validating JavaScript objects.
Installation
JOV is available as the jov package on npm.
$ npm install --save jovUsage
const jov = require("jov");
const schema = { username: new jov.string(true).required().min(3) };
const data = { username: "oenstrom" };
jov.validate(data, schema, "json");More info coming soon.
API
JString(strict = false)
strict = true - makes the validation check the type of the key.
.required()- Set the key to be required..min(minValue)- Set a minimum required length..max(maxValue)- Set a maxmium length..email()- Set the key to only accept email format..alphanum()- Set the key to only accept alphanumeric characters.
validate(data, schema, format = "obj")
*data = the data to validate.*
*schema = the schema that data validates against.*
*format = the format to output error as. Available formats: "obj" and "json".*
License
JOV is MIT licensed.