express-validator
Advanced tools
Comparing version 2.9.1 to 2.10.0
## Change Log | ||
### upcoming 2015/05/04 | ||
- [bc2ef59](https://github.com/ctavan/express-validator/commit/bc2ef59b5a5c45be12f6efb27199a29d8689ac2f) Use the same node versions as node-validator. (@rustybailey) | ||
- [0c3aaec](https://github.com/ctavan/express-validator/commit/0c3aaecb0f7d4a75a1bc20e94290cfe72e98a49c) Bump validator version to 3.39.0 (@rustybailey) | ||
- [dfb757b](https://github.com/ctavan/express-validator/commit/dfb757b8eafe3149c552be4b92eb259fb6bdd5e5) Add changelog to devDependencies and add npm script to generate changelog. (@rustybailey) | ||
- [bf044b5](https://github.com/ctavan/express-validator/commit/bf044b577f6999a7f1e92cb9f74ddf4a44bd78d3) Add node 0.12 to travis.yml, remove dead gist link in README, add license in package.json. (@rustybailey) | ||
- [f42077f](https://github.com/ctavan/express-validator/commit/f42077fabfc9b8ef6100069b17e83f5fab2eb395) Add editorconfig. (@rustybailey) | ||
- [73daa44](https://github.com/ctavan/express-validator/commit/73daa44dee192049da4fff732dec629a6630af73) Add jshint to devDependencies, add .jshintrc, fix semicolon issues. (@rustybailey) | ||
- [fb8d049](https://github.com/ctavan/express-validator/commit/fb8d049dd1f0a0da6c0070cf160316f9b732a732) Add comment to explain before() function busting require's cache in each test file. (@rustybailey) | ||
- [7fc7b1c](https://github.com/ctavan/express-validator/commit/7fc7b1c54c22f19dfc650cba06b47e6e05d0c653) Remove async from devDependencies (@rustybailey) | ||
- [a74de1e](https://github.com/ctavan/express-validator/commit/a74de1eb3ef2bdf67beb5be4fd3a8e51e4d190b5) Remove old tests and change npm test to use Mocha. (@rustybailey) | ||
- [39f1b55](https://github.com/ctavan/express-validator/commit/39f1b55f817a7ca1f0fc802247ba8dd0d24ff21f) Add Mocha tests for validating regex routes (@rustybailey) | ||
- [68adc6e](https://github.com/ctavan/express-validator/commit/68adc6e76b6abb3f0c1946c3c51ca16c1cebe9b6) Add Mocha tests for nested input (@rustybailey) | ||
- [a029176](https://github.com/ctavan/express-validator/commit/a029176a7c7ac0666f0b93adca0d2ea0a57ff98b) Add Mocha tests for mapped output using validationErrors(true) (@rustybailey) | ||
- [5a2f7ef](https://github.com/ctavan/express-validator/commit/5a2f7ef3a5a0f59fb9f6692e2e5d93f81b5e497b) Add Mocha tests for check() (@rustybailey) | ||
- [9cd6f62](https://github.com/ctavan/express-validator/commit/9cd6f626cb287f1a877e0f645690b528938f3dc4) Add Mocha tests for checkQuery() (@rustybailey) | ||
- [c91e022](https://github.com/ctavan/express-validator/commit/c91e0220312097548abaf21d91e076e18726f3ab) Add Mocha tests for checkBody() (@rustybailey) | ||
- [bbcb462](https://github.com/ctavan/express-validator/commit/bbcb4620ada424a2352a148975eba2072d8badf3) Add tests for checkParams() (@rustybailey) | ||
- [d2eb638](https://github.com/ctavan/express-validator/commit/d2eb638611a015dd04d4aa59c4c790ca324bcc66) Add mocha/chai as dependencies, simplify app.js helper, create mocha tests for optional(). (@rustybailey) | ||
### v2.9.1 2015/04/28 | ||
- [9c87684](https://github.com/ctavan/express-validator/commit/9c87684a02eff71f40fc98ce3da37992fee464cd) Bump version to 2.9.1. (@rustybailey) | ||
- [37ede78](https://github.com/ctavan/express-validator/commit/37ede786203d5b9aa87acf96bd568c26fcc6de3a) Fix checkHeader so that it works with optional(). (@rustybailey) | ||
- [136307f](https://github.com/ctavan/express-validator/commit/136307f94aebaf4dcc7e83dee62bfd5cae9a1333) Move change log into its own file and expand it using github-changes. Fixes #130 (@rustybailey) | ||
### v2.9.0 2015/03/20 | ||
@@ -4,0 +28,0 @@ - [c2e5124](https://github.com/ctavan/express-validator/commit/c2e512490667cc1cbc22e2de762c79cbf425354a) Bump version to 2.9.0 (@ctavan) |
module.exports = require('./lib/express_validator.js'); |
@@ -53,3 +53,3 @@ /* | ||
return result; | ||
} | ||
}; | ||
} | ||
@@ -59,3 +59,3 @@ }); | ||
return methods; | ||
} | ||
}; | ||
@@ -84,3 +84,3 @@ function checkParam(req, getter) { | ||
if (value === undefined) { | ||
value = getter(item) | ||
value = getter(item); | ||
} else { | ||
@@ -104,3 +104,3 @@ value = value[item]; | ||
return this; | ||
} | ||
}; | ||
@@ -120,3 +120,3 @@ var methods = []; | ||
return methods; | ||
} | ||
}; | ||
} | ||
@@ -140,7 +140,7 @@ }); | ||
return methods.isLength(1); | ||
} | ||
}; | ||
methods['len'] = function() { | ||
return methods.isLength.apply(methods.isLength, Array.prototype.slice.call(arguments)); | ||
} | ||
}; | ||
@@ -160,3 +160,3 @@ methods['optional'] = function() { | ||
return methods; | ||
} | ||
}; | ||
} | ||
@@ -229,3 +229,3 @@ return function(req, res, next) { | ||
return req._validationErrors; | ||
} | ||
}; | ||
@@ -260,4 +260,4 @@ req.filter = function(item) { | ||
}; | ||
} | ||
}; | ||
module.exports = expressValidator; | ||
module.exports.validator = validator; |
@@ -9,6 +9,8 @@ { | ||
"@zero21xxx", | ||
"Roman Kalyakin <roman@kalyakin.com>" | ||
"Roman Kalyakin <roman@kalyakin.com>", | ||
"Rusty Bailey <rustylbailey@gmail.com>" | ||
], | ||
"version": "2.9.1", | ||
"version": "2.10.0", | ||
"homepage": "https://github.com/ctavan/express-validator", | ||
"license": "MIT", | ||
"repository": { | ||
@@ -20,14 +22,19 @@ "type": "git", | ||
"scripts": { | ||
"test": "make test" | ||
"test": "mocha ./test", | ||
"changelog": "github-changes -o ctavan -r express-validator -a -m YYYY/MM/DD --no-merges" | ||
}, | ||
"engines": { | ||
"node": ">= 0.8" | ||
"node": ">= 0.10" | ||
}, | ||
"dependencies": { | ||
"validator": "3.34.0" | ||
"validator": "3.39.0" | ||
}, | ||
"devDependencies": { | ||
"async": "~0.1.22", | ||
"express": "~2.5.11", | ||
"request": "~2.10.0" | ||
"body-parser": "1.12.3", | ||
"chai": "2.3.0", | ||
"express": "4.12.3", | ||
"github-changes": "1.0.0", | ||
"jshint": "2.7.0", | ||
"mocha": "2.2.4", | ||
"supertest": "0.15.0" | ||
}, | ||
@@ -34,0 +41,0 @@ "keywords": [ |
@@ -8,5 +8,2 @@ # express-validator | ||
This is basically a copy of a [gist]( https://gist.github.com/752126 ) by | ||
node-validator author [chriso]( https://github.com/chriso ). | ||
## Installation | ||
@@ -13,0 +10,0 @@ |
// Sample app | ||
var express = require('express'); | ||
var expressValidator = require('../../index'); | ||
var bodyParser = require('body-parser'); | ||
function App(port, validation) { | ||
this.app = null; | ||
this.port = port; | ||
this.validation = validation; | ||
} | ||
module.exports = App; | ||
var port = process.env.PORT || 8888; | ||
var app = express(); | ||
App.prototype.start = function() { | ||
var self = this; | ||
self.app = express.createServer(); | ||
module.exports = function(validation) { | ||
self.app.use(express.bodyParser()); | ||
self.app.use(expressValidator({ | ||
app.set('port', port); | ||
app.use(bodyParser.json()); | ||
app.use(expressValidator({ | ||
customValidators: { | ||
@@ -25,11 +21,7 @@ isArray: function(value) { | ||
self.app.get(/\/test(\d+)/, self.validation); | ||
self.app.get('/:testparam?', self.validation); | ||
self.app.post('/:testparam?', self.validation); | ||
app.get(/\/test(\d+)/, validation); | ||
app.get('/:testparam?', validation); | ||
app.post('/:testparam?', validation); | ||
self.app.listen(this.port); | ||
}; | ||
App.prototype.stop = function() { | ||
this.app.close(); | ||
}; | ||
return app; | ||
}; |
@@ -0,0 +0,0 @@ var util = require('util'), |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
64671
813
1
7
243
2
+ Addedvalidator@3.39.0(transitive)
- Removedvalidator@3.34.0(transitive)
Updatedvalidator@3.39.0