Skip to content

nujii/architect-validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

architect-validator

validator plugin for architect

Config Format

{
  "packagePath": "./node_modules/architect-validator",
  "sanitize": true
}

Usage

Validate that ssssshtuff

module.exports = function (options, imports, register) {

  var validator = imports.validator;

  var obj = {
    email: "this isn't an email",
    name: "My name can be whatever"
  }

  validator(obj, function(key, value){
    // throw an exception or return false
    if (key == 'email') {
      return isEmail(value);
    }
  }, function(errors){
    // Errors come back as a list of kv's
    // errors == [{key: 'email', "My name can be whatever"}]
  });

};

About

Validator for architect

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published