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

conformity

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

conformity - npm Package Compare versions

Comparing version 0.0.1-pre4 to 0.0.1-pre5

18

lib/index.js

@@ -75,13 +75,13 @@ var Joi = require('joi');

}
}
if (validate.response) {
var send = res.send;
res.send = function(body) {
var status = self.validator.validate(body, validate.response);
if (status.error) {
return handleFailure(status);
if (validate.response) {
var send = res.send;
res.send = function(body) {
var status = self.validator.validate(body, validate.response);
if (status.error) {
return handleFailure(status);
}
return send(status.body);
}
return send(status.body);
}

@@ -88,0 +88,0 @@ }

{
"name": "conformity",
"version": "0.0.1-pre4",
"version": "0.0.1-pre5",
"description": "JSON validation middleware for express.js, kitchensink, etc",

@@ -25,3 +25,6 @@ "main": "index.js",

],
"author": "Van Nguyen <thegoleffect@gmail.com>",
"author": {
"name": "Van Nguyen",
"email": "thegoleffect@gmail.com"
},
"license": "MIT",

@@ -31,3 +34,13 @@ "dependencies": {

"xss": "^0.2.10"
}
},
"readme": "# Conformity - HTTP Parameter Validation Middleware\n\n[![Dependency Status](https://david-dm.org/thegoleffect/conformity.svg)](https://david-dm.org/thegoleffect/conformity.svg)\n[![devDependency Status](https://david-dm.org/thegoleffect/conformity/dev-status.svg)](https://david-dm.org/thegoleffect/conformity/dev-status.svg)\n\nConformity is a JSON validation middleware for express.js. It lets you perform path, query, payload, and response validation without polluting your handler code. Additionally, it performs XSS html escaping automatically.\n\n## Getting Started\n\n```\nnpm install --save conformity\n```\n\n\n```\nvar Express = require('express');\nvar Conformity = require('conformity');\nvar Joi = Conformity.validator;\n\nvar app = Express();\n\n// CONFORMITY USAGE:\napp.use(Conformity.validate());\nvar IndexHandler = function (req, res) {\n return 'Hello! ' + req.params.name;\n}\nIndexHandler.validate = {\n path: {\n name: Joi.string().required()\n }\n};\n\napp.get('/:name', IndexHandler);\n\napp.listen(3000);\n```",
"readmeFilename": "README.md",
"gitHead": "db386179e4a1479f6d6c16ea395693cf55144631",
"bugs": {
"url": "https://github.com/thegoleffect/conformity/issues"
},
"homepage": "https://github.com/thegoleffect/conformity",
"_id": "conformity@0.0.1-pre5",
"_shasum": "fedb519750687cfb022b9e9a32592e0abb871b63",
"_from": "conformity@0.0.1-pre5"
}

@@ -6,2 +6,32 @@ # Conformity - HTTP Parameter Validation Middleware

Conformity is...
Conformity is a JSON validation middleware for express.js. It lets you perform path, query, payload, and response validation without polluting your handler code. Additionally, it performs XSS html escaping automatically.
## Getting Started
```
npm install --save conformity
```
```
var Express = require('express');
var Conformity = require('conformity');
var Joi = Conformity.validator;
var app = Express();
// CONFORMITY USAGE:
app.use(Conformity.validate());
var IndexHandler = function (req, res) {
return 'Hello! ' + req.params.name;
}
IndexHandler.validate = {
path: {
name: Joi.string().required()
}
};
app.get('/:name', IndexHandler);
app.listen(3000);
```
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