piggy-proof

0.0.22 • Public • Published

piggy-proof

Validation library for PiggyPot. Validation rules are held in a central 'models' directory - this reduces duplication of rules across the codebase.

Installation

npm install --save piggy-proof

Usage

var PiggyProof = require('piggy-proof');
 
var data = {
  username: '',
  password: 'ab'
};
 
var validationResults = PiggyProof.validate(data, 'users');
// => {
//   username: [ 'is not present' ],
//   password: [ 'is below the minimum length' ]
// }
 
PiggyProof.isValid(validationResults)
// => false

Running Tests

npm test

Dependents (0)

Package Sidebar

Install

npm i piggy-proof

Weekly Downloads

3

Version

0.0.22

License

MIT

Last publish

Collaborators

  • overture8
  • willmcneilly