Skip to content

mikanda/form-validate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

form-validate

Extends schema validate to give reasonable error messages.

Usage

var FormValidate = require('form-validate');
var Model = model(...)
  .use(FormValidate(msgs))
  .attr(...)
  ...;
var m = new Model().validate();
m.errors // => [ ... ];

API

FormValidate(msgs : Array)

msgs is the array of the messages to use. They should have a form like the following:

[
  {
    // the field which is responsible for the error as key

    'required': 'My message'
  }
]

About

Extends schema validate to give reasonable error messages.

Resources

Stars

Watchers

Forks

Packages

No packages published