Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 551 Bytes

Readme.md

File metadata and controls

33 lines (24 loc) · 551 Bytes

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'
  }
]