express-form
Advanced tools
Comparing version 0.7.1 to 0.7.2
@@ -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; |
@@ -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() { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
71314
1561
0