var validate = jsen({
type: 'object',
properties: {
username: {
type: 'string',
minLength: 4
}
}
});
validate({ username: 'john' }); // true
validate({ username: 'jim' }); // false
Run in JS Bin
JSEN (JSON Sentinel) validates JSON objects using JSON Schema. Uses dynamic code generation to produce high-performance functions that V8 and other JavaScript engines can optimize. Works both in node and the browser.