New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

expressjs-plus

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expressjs-plus - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

29

lib/index.js

@@ -89,16 +89,17 @@ 'use strict';

* @example
* ```js
* function regularFunc(someVar, cb){
* console.log(someVar);
* return cb(null, {response: someVar+="addedString"});
* }
* var fun = GMV(regularFunc);
* fun =>
* function mw(req, res, next){
* let someVar = req.query.someVar;
* console.log(someVar);
* res.locals.response = someVar+="addedString";
* return next();
* }
* ```
```js
function regularFunc(someVar, cb){
console.log(someVar);
return cb(null, {response: someVar+="addedString"});
}
// middleware version of regularFunc
var func = GMV(regularFunc);
// func will behave like this
function mw(req, res, next){
let someVar = req.query.someVar;
console.log(someVar);
res.locals.response = someVar+="addedString";
return next();
}
```
*/

@@ -105,0 +106,0 @@ this.getMiddlewareVersion = this.GMV = function (func) {

{
"name": "expressjs-plus",
"version": "0.0.3",
"version": "0.0.4",
"description": "A pluggable expansion to express js aimed at adding much needed features and helpers.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -22,3 +22,3 @@ <a name="ExpressPlus"></a>

### new exports.ExpressPlus(app, passedParamHandlers, passedErrorHandlers)
### new ExpressPlus(app, passedParamHandlers, passedErrorHandlers)

@@ -32,3 +32,4 @@ | Param | Type | Description |

**Example**
// Usage
// Usage
```js

@@ -53,3 +54,4 @@ var express = require('express');

**Example**
//this is an example of a paramHandler function that is interested in the user parameter
//this is an example of a paramHandler function that is interested in the user parameter
```js

@@ -83,3 +85,4 @@ function userHandler(param, paramsArray, req){

### expressPlus.getMiddlewareVersion ⇒
Returns a middleware version of the function passed, this function replaces the last parameter with a callback function to work with express js.
Returns a middleware version of the function passed, this function replaces the last parameter with a callback
function to work with express js.

@@ -94,3 +97,18 @@ **Kind**: instance property of <code>[ExpressPlus](#ExpressPlus)</code>

**Example**
```js function regularFunc(someVar, cb){ console.log(someVar); return cb(null, {response: someVar+="addedString"}); } var fun = GMV(regularFunc); fun => function mw(req, res, next){ let someVar = req.query.someVar; console.log(someVar); res.locals.response = someVar+="addedString"; return next(); } ```
```js
function regularFunc(someVar, cb){
console.log(someVar);
return cb(null, {response: someVar+="addedString"});
}
// middleware version of regularFunc
var func = GMV(regularFunc);
// func will behave like this
function mw(req, res, next){
let someVar = req.query.someVar;
console.log(someVar);
res.locals.response = someVar+="addedString";
return next();
}
```
<a name="ExpressPlus+setErrorHandlers"></a>

@@ -122,3 +140,4 @@

### expressPlus.defaultCbWithResponse(cb, [status])
Handles callbacks and puts response & status in the second callback argument if successful Replace your callback with this if appropriate.
Handles callbacks and puts response & status in the second callback argument if successful
Replace your callback with this if appropriate.

@@ -135,3 +154,4 @@ **Kind**: instance method of <code>[ExpressPlus](#ExpressPlus)</code>

### expressPlus.defaultCb(cb, [resource])
Handles callbacks. Replace your callback with this if appropriate.
Handles callbacks.
Replace your callback with this if appropriate.

@@ -159,7 +179,12 @@ **Kind**: instance method of <code>[ExpressPlus](#ExpressPlus)</code>

### ExpressPlus~lastHandler(param, paramsArray, req) ⇒ <code>boolean</code>
Default parameter handler used in getMiddlewareVersion. Every parameter is passed to a set of functions to be handled, this is the last handler that just pushes the parameter to the paramsArray.
Default parameter handler used in getMiddlewareVersion.
Every parameter is passed to a set of functions to be handled, this is the last handler that just pushes
the parameter to the paramsArray.
**Kind**: inner method of <code>[ExpressPlus](#ExpressPlus)</code>
**Returns**: <code>boolean</code> - if true is returned, the parameter will be considered handled and the function [GMV](GMV) will move on to the next parameter. if false is returned, the next handler on the list will attempt to handle the parameter until this methods turn comes, which will always return true
**See**: [dataHandler](dataHandler) this function is a more real example of a parameter handler, it is used to integrate with another library [https://www.npmjs.com/package/simple-express-validator](https://www.npmjs.com/package/simple-express-validator)
**Returns**: <code>boolean</code> - if true is returned, the parameter will be considered handled and the function [GMV](GMV) will
move on to the next parameter. if false is returned, the next handler on the list will attempt to handle the
parameter until this methods turn comes, which will always return true
**See**: [dataHandler](dataHandler) this function is a more real example of a parameter handler, it is used to integrate
with another library [https://www.npmjs.com/package/simple-express-validator](https://www.npmjs.com/package/simple-express-validator)

@@ -166,0 +191,0 @@ | Param | Type | Description |

@@ -73,16 +73,18 @@ /**

* @example
* ```js
* function regularFunc(someVar, cb){
* console.log(someVar);
* return cb(null, {response: someVar+="addedString"});
* }
* var fun = GMV(regularFunc);
* fun =>
* function mw(req, res, next){
* let someVar = req.query.someVar;
* console.log(someVar);
* res.locals.response = someVar+="addedString";
* return next();
* }
* ```
```js
function regularFunc(someVar, cb){
console.log(someVar);
return cb(null, {response: someVar+="addedString"});
}
// middleware version of regularFunc
var func = GMV(regularFunc);
// func will behave like this
function mw(req, res, next){
let someVar = req.query.someVar;
console.log(someVar);
res.locals.response = someVar+="addedString";
return next();
}
```
*/

@@ -89,0 +91,0 @@ this.getMiddlewareVersion = this.GMV = (func) => {

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