express-mung
Advanced tools
Comparing version 0.1.0 to 0.1.1
{ | ||
"name": "express-mung", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Transform an express response (or make until no good)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -41,8 +41,14 @@ # express-mung [![Build Status](https://travis-ci.org/richardschneider/express-prefer.svg)](https://travis-ci.org/richardschneider/express-mung) | ||
See the mocha [tests](https://github.com/richardschneider/express-mung/tree/master/test) for some more examples. | ||
## Reference | ||
- `mung.json(fn)` transform the JSON body of the response. `fn` receives the JSON as an object, the `req` and `res`. It returns the modified body. If `undefined` is returned (i.e. nothing) then original JSON is assumed to be modified. If `null` is returned, then a 204 No Content HTTP status is returned to client. | ||
- `mung.json(fn)` transform the JSON body of the response. `fn(json, req, res)` receives the JSON as an object, the `req` and `res`. It returns the modified body. If `undefined` is returned (i.e. nothing) then the original JSON is assumed to be modified. If `null` is returned, then a 204 No Content HTTP status is returned to client. | ||
- `mung.jsonAsync(fn)` transform the JSON body of the response. `fn` receives the JSON as an object, the `req` and `res`. It returns a promise to a modified body. The promise returns an object. If it is `null` then a 204 No Content is sent to the client. | ||
- `mung.jsonAsync(fn)` transform the JSON body of the response. `fn(json, req, res)` receives the JSON as an object, the `req` and `res`. It returns a promise to a modified body. The promise returns an `object.` If it is `null` then a 204 No Content is sent to the client. | ||
- `mung.headers(fn)` transform the HTTP headers of the response. `fn(req, res)` receives the `req` and `res`. It should modify the header(s) and then return. | ||
- `mung.headersAsync(fn)` transform the HTTP headers of the response. `fn(req, res)` receives the `req` and `res`. It returns a `promise` to modify the header(s). | ||
# License | ||
@@ -49,0 +55,0 @@ The MIT license |
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
11687
57
0