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.7.1 to 0.7.2

5

lib/field.js

@@ -133,3 +133,3 @@ var validator = require("validator")

return this.add(function (value) {
return value.toUpperCase();
return value.toString().toUpperCase();
});

@@ -140,3 +140,3 @@ };

return this.add(function (value) {
return value.toLowerCase();
return value.toString().toLowerCase();
});

@@ -147,2 +147,3 @@ };

return this.add(function (value) {
value = value.toString();
if (value.length <= length) {

@@ -149,0 +150,0 @@ return value;

2

package.json

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

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

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

@@ -6,18 +6,7 @@ var assert = require("assert"),

express = require("express"),
http = require("http"),
app = express();
http.createServer(app).listen(3000);
app = express.createServer();
// some duct-tape to make assert.response work with express 3.x
app.address = function() {
return {port: 3000};
};
app.close = function() {
process.exit(0);
};
app.configure(function() {
app.use(express.bodyParser());
app.use(app.router);
});

@@ -24,0 +13,0 @@

@@ -204,2 +204,14 @@ var assert = require("assert"),

},
'filter : toUpper : object': function() {
var request = { body: { email: { key: '1' }}};
form(filter("email").toUpper())(request, {});
assert.strictEqual(request.form.email, '[OBJECT OBJECT]');
},
'filter : toUpper : array': function() {
var request = { body: { email: ['MyEmaiL1@example.com', 'myemail2@example.org'] }};
form(filter("email").toUpper())(request, {});
assert.strictEqual(request.form.email, 'MYEMAIL1@EXAMPLE.COM');
},

@@ -211,2 +223,14 @@ 'filter : toLower': function() {

},
'filter : toLower : object': function() {
var request = { body: { email: { key: '1' }}};
form(filter("email").toLower())(request, {});
assert.strictEqual(request.form.email, '[object object]');
},
'filter : toLower : array': function() {
var request = { body: { email: ['MyEmaiL1@example.com', 'myemail2@example.org'] }};
form(filter("email").toLower())(request, {});
assert.strictEqual(request.form.email, 'myemail1@example.com');
},

@@ -234,2 +258,14 @@ 'filter : truncate': function() {

},
'filter : truncate : object': function() {
var request = { body: { email: { key: '1', length: 100 }}};
form(filter("email").truncate(10))(request, {});
assert.strictEqual(request.form.email, '[object...');
},
'filter : truncate : array': function() {
var request = { body: { email: ['myemail1@example.com', 'myemail2@example.org'] }};
form(filter("email").truncate(11))(request, {});
assert.strictEqual(request.form.email, 'myemail1...');
},

@@ -236,0 +272,0 @@ 'filter : custom': 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