Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

enforce

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enforce - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

45

lib/Enforce.js

@@ -5,2 +5,3 @@ exports.Enforce = Enforce;

this.validations = {};
this.ctx = {};
this.options = {

@@ -24,2 +25,13 @@ returnAllErrors : (opts && !!opts.returnAllErrors)

Enforce.prototype.context = function (name, value) {
if (arguments.length === 0) {
return this.ctx;
}
if (arguments.length == 1) {
return this.ctx[name];
}
this.ctx[name] = value;
return this;
};
Enforce.prototype.clear = function () {

@@ -39,20 +51,25 @@ this.validations = {};

validation.validator(data[validation.property], function (msg) {
if (msg) {
var err = new Error(msg);
this.ctx.property = validation.property;
err.property = validation.property;
err.value = data[validation.property];
err.msg = msg;
err.type = "validation";
validation.validator.apply(data, [
data[validation.property], function (msg) {
if (msg) {
var err = new Error(msg);
if (!this.options.returnAllErrors) {
return cb(err);
err.property = validation.property;
err.value = data[validation.property];
err.msg = msg;
err.type = "validation";
if (!this.options.returnAllErrors) {
return cb(err);
}
errors.push(err);
}
errors.push(err);
}
return next();
}.bind(this));
return next();
}.bind(this),
this.ctx
]);
}.bind(this);

@@ -59,0 +76,0 @@

@@ -10,3 +10,3 @@ {

],
"version" : "0.1.0",
"version" : "0.1.1",
"license" : "MIT",

@@ -13,0 +13,0 @@ "repository" : "http://github.com/dresende/node-enforce.git",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc