New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

piggy-proof

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

piggy-proof

Validate an object of properties meets given validation rules

0.0.3
npm
Version published
Weekly downloads
22
1000%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

validation

FAQs

Package last updated on 08 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts