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

express-form

Package Overview
Dependencies
Maintainers
2
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-form - npm Package Compare versions

Comparing version 0.9.0 to 0.9.1

9

lib/field.js

@@ -311,2 +311,11 @@ var validator = require("validator")

Field.prototype.isString = function (message) {
return this.add(function (value) {
if (!object.isString(value)) {
return { error: message || "%s is not a string" };
}
return { valid: true };
});
};
Field.prototype.regex = Field.prototype.is = function (pattern, modifiers, message) {

@@ -313,0 +322,0 @@ // regex(/pattern/)

2

package.json

@@ -5,3 +5,3 @@ {

"description": "Form validation and data filtering for Express",
"version": "0.9.0",
"version": "0.9.1",
"homepage": "http://dandean.github.com/express-form",

@@ -8,0 +8,0 @@ "repository": {

@@ -473,2 +473,13 @@ var assert = require("assert"),

},
'validation : isString()': function() {
var request = { body: { username: 'adasds@example.com', password: { 'somevalue': '1' } }};
form(validate('password', 'Password')
.required()
.isString()
.minLength(10, '%s must be a minimum of 10 characters')
.maxLength(256, '%s must be a maximum of 256 characters'))(request, {});
assert.ok(!request.form.isValid);
assert.strictEqual(request.form.errors[0], 'Password is not a string');
},

@@ -475,0 +486,0 @@ 'validation : maxLength': function() {

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