req-requires
Advanced tools
Comparing version 0.0.8 to 0.0.9
{ | ||
"name": "req-requires", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "Add assertions to ExpressJS middleware", | ||
@@ -16,2 +16,3 @@ "main": "./lib/req-requires.js", | ||
"validation", | ||
"assert", | ||
"http", | ||
@@ -18,0 +19,0 @@ "validate", |
@@ -52,5 +52,8 @@ **req-requires.js** is a library that is used to validate properties on the request object in expressjs route handlers. | ||
```javascript | ||
req.requires.property('auth_provider').toExist(); | ||
req.requires.property('body.email').toExist(); | ||
req.requires.property('params.id').toMatch(/^[0-9a-fA-F]{24}$/); | ||
toExist - the given property must exist in the request object | ||
toBeType - the property must match the given type | ||
toMatch - the property matches the given regex | ||
toBeIn - the property is a member of the given array | ||
``` |
Sorry, the diff of this file is not supported yet
29872
59