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 - npm Package Compare versions

Comparing version

to
0.0.2

2

package.json
{
"name": "piggy-proof",
"version": "0.0.1",
"version": "0.0.2",
"description": "Validate an object of properties meets given validation rules",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -21,2 +21,3 @@ var RuleParser = require('./rule-parser');

Object.keys(data).forEach(function(field) {
if (parsedRules[field] === undefined) { return; } // continue to next loop
validationResults[field] = [];

@@ -23,0 +24,0 @@

@@ -25,2 +25,16 @@ var expect = require('chai').expect;

it('should ignore fields that do not exist on the model', function(done) {
var data = {
username: '',
password: 'ab1',
noExistField: 'asdf'
};
expect(PiggyProof.validate(data, 'users')).to.deep.equal({
username: [ 'is not present' ],
password: [ 'is below the minimum length' ]
});
done();
});
it('should determine whether validation results are valid', function(done) {

@@ -27,0 +41,0 @@ var invalidData = {