Socket
Socket
Sign inDemoInstall

express-json-validator-middleware

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-json-validator-middleware - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

package.json
{
"name": "express-json-validator-middleware",
"version": "1.0.1",
"version": "1.0.2",
"description": "An Express middleware to validate requests against JSON Schemas",

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

@@ -46,5 +46,5 @@ # express-json-validator-middleware

3. *Optional* - Define a shortcut function. This is not needed, and it is perfectly okay to use validator.validate()
3. *Optional* - Define a shortcut function. Bind is necessary here in order to pass ```this``` correctly
```js
var validate = validator.validate;
var validate = validator.validate.bind(validator);
```

@@ -98,3 +98,3 @@

// Define a shortcut. It is perfectly okay ot use validator.validate()
var validate = validator.validate;
var validate = validator.validate.bind(validator);

@@ -101,0 +101,0 @@ // Define a JSON Schema

@@ -14,3 +14,3 @@ var Ajv = require('ajv');

validate(options) {
var that = this;
var self = this;
return function (req, res, next) {

@@ -21,3 +21,3 @@ var validationErrors = {};

let schema = options[requestProperty];
let validateFunction = that.ajv.compile(schema);
let validateFunction = this.ajv.compile(schema);

@@ -29,3 +29,3 @@ var valid = validateFunction(req[requestProperty]);

}
});
}, self);

@@ -32,0 +32,0 @@ if (Object.keys(validationErrors).length != 0) {

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