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

express-validator

Package Overview
Dependencies
Maintainers
3
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-validator - npm Package Compare versions

Comparing version 5.0.2 to 5.0.3

2

package.json

@@ -9,3 +9,3 @@ {

],
"version": "5.0.2",
"version": "5.0.3",
"homepage": "https://github.com/ctavan/express-validator",

@@ -12,0 +12,0 @@ "license": "MIT",

@@ -1,2 +0,2 @@

const { checkSchema, validationResult } = require('./check');
const { check, checkSchema, validationResult } = require('./check');

@@ -6,14 +6,21 @@ const express = require('express');

app.use(express.json());
app.post('/*', checkSchema({
foo: {
in: ['body'],
exists: {
errorMessage: 'bla'
},
custom: {
options: value => (value || '').startsWith('foo')
}
}
}), (req, res) => {
console.log(req.body);
app.post('/*', [
check('password')
// .isLength({min: 6})
// .withMessage("Minimum Length must be at least 6")
// .optional({ checkFalsy: true })
// .custom(() => true)
,
check('passwordConfirmation').custom((value, { req }) => {
if(req.body.password === value)
return true;
else
throw new Error("Password Doesn't match");
})
], (req, res) => {
console.log('body', req.body);
console.log('query', req.query);
console.log('headers', req.headers);
console.log('params', req.params);
console.log('cookies', req.cookies);
res.json(validationResult(req).array());

@@ -20,0 +27,0 @@ });

@@ -5,5 +5,8 @@ const _ = require('lodash');

module.exports = (req, context) => {
selectFields(req, context).forEach(instance => {
selectFields(req, context).filter(instance => {
const initialValue = _.get(req[instance.location], instance.path);
return initialValue !== instance.value;
}).forEach(instance => {
_.set(req[instance.location], instance.path, instance.value);
});
};
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