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

express-form

Package Overview
Dependencies
Maintainers
0
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.5.2 to 0.5.3

._TODO.md

6

._package.json

@@ -1,4 +0,4 @@

Mac OS X  2��ATTRf>��#�#com.macromates.caret{
column = 58;
line = 12;
Mac OS X  2��ATTR�ҳ��#�#com.macromates.caret{
column = 51;
line = 26;
}

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

// break ejs: <%= field-name %> becomes <%= fieldName %> in your views.
res.locals[camelize(name)] = req[source][name];
if (typeof res.locals == 'function') { // Express 2.0 Support
res.local(camelize(name),req[source][name]);
} else {
res.locals[camelize(name)] = req[source][name];
}
}

@@ -56,0 +60,0 @@

@@ -28,6 +28,8 @@ var validator = require("validator"),

validate.getValue = function(name) {
var match = name.match(/^([^\[]*)(?:\[(.*)\])*$/);
var value = formData[match[1] || name];
if(match.length > 2) { // if complex property (e.g. user[info][password])
for(var mi = 2, mval; mval = match[mi]; mi++) value = value[mval];
var match = name.match(/[^\[\]]*/g).filter(function(m){ return !!m; })
var value = formData[match[0] || name];
if(match.length > 1) { // if complex property (e.g. user[info][password])
for(var mi = 1, mval; mval = match[mi]; mi++){
value = value[mval];
}
}

@@ -108,7 +110,8 @@ return value;

// and use that as the OTHER value.
var test = other;
if (object.isString(other) && other.match(/^field::/)) {
other = arguments.callee.getValue(other.replace(/^field::/, ''));
test = arguments.callee.getValue(other.replace(/^field::/, ''));
}
if (value != other) {
throw new Error(message || "%s does not equal " + String(other));
if (value != test) {
throw new Error(message || "%s does not equal " + String(test));
}

@@ -115,0 +118,0 @@ });

{
"name": "express-form",
"description": "Form validation and data filtering for Express",
"version": "0.5.2",
"version": "0.5.3",
"homepage": "http://dandean.github.com/express-form",

@@ -27,4 +27,4 @@ "repository": {

"type" : "MIT",
"url" : "http://github.com/chriso/node-validator/raw/master/LICENSE"
"url" : "http://github.com/dandean/express-form/raw/master/LICENSE"
}]
}

@@ -521,9 +521,11 @@ var assert = require("assert"),

"validation : complex properties": function() {
var request = { body: { field: { inner: "value" }}};
var request = { body: { field: { inner: "value", even: { more: { inner: "value" }}}}};
form(
validate("field[inner]").required().equals("value"),
validate("field[inner]").required().equals("fail")
validate("field[inner]").required().equals("fail"),
validate("field[even][more][inner]").required().equals("value"),
validate("field[even][more][inner]").required().equals("fail")
)(request, {});
assert.equal(request.form.errors.length, 1);
assert.equal(request.form.errors.length, 2);
}
};

@@ -14,3 +14,2 @@ TODO

* Default message overrides?
* Connection to express-contrib/flash?

@@ -28,4 +27,4 @@

* **Async validation (for databases, etc)**
* Add notes on how to extend the filters and validators
* Change node-validator toUppercase/toLowercase to use standard JS caps: toUpper**C**ase, toLower**C**ase.
* Document autoLocals configuration.
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