express-response-formatter
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -8,2 +8,8 @@ # Changelog | ||
## [2.0.2] - 2020-08-12 | ||
### Added | ||
- Add auto complete for TypeScript. | ||
## [2.0.1] - 2020-08-11 | ||
@@ -10,0 +16,0 @@ |
import { Request, Response, NextFunction } from 'express'; | ||
interface LooseObject { | ||
[key: string]: any; | ||
} | ||
import { Methods } from './methods'; | ||
declare type ResponseFunction = { | ||
[key in Methods]: (data: any, meta?: any) => void; | ||
}; | ||
declare global { | ||
namespace Express { | ||
interface Response { | ||
formatter: LooseObject; | ||
formatter: ResponseFunction; | ||
} | ||
} | ||
} | ||
declare const responseEnhancer: () => (req: Request<import("express-serve-static-core").ParamsDictionary>, res: Response<any>, next: NextFunction) => void; | ||
declare const responseEnhancer: () => (req: Request, res: Response, next: NextFunction) => void; | ||
export { responseEnhancer }; |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.responseEnhancer = void 0; | ||
var methods_1 = __importDefault(require("./methods")); | ||
@@ -8,0 +9,0 @@ var responseEnhancer = function () { return function (req, res, next) { |
@@ -0,3 +1,4 @@ | ||
declare type Methods = 'ok' | 'created' | 'accepted' | 'noContent' | 'badRequest' | 'unauthorized' | 'forbidden' | 'notFound' | 'methodNotAllowed' | 'timeout' | 'conflict' | 'unprocess' | 'tooManyRequests' | 'serverError' | 'badGateway' | 'serviceUnavailable' | 'gatewayTimeout'; | ||
interface Method { | ||
name: string; | ||
name: Methods; | ||
code: string; | ||
@@ -8,3 +9,3 @@ message: string; | ||
declare const methods: Method[]; | ||
export { Method }; | ||
export { Method, Methods }; | ||
export default methods; |
{ | ||
"name": "express-response-formatter", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"main": "lib/index.js", | ||
@@ -5,0 +5,0 @@ "types": "lib/index.d.ts", |
@@ -15,2 +15,4 @@ # express-response-formatter | ||
![Usage](usage.gif) | ||
## Installation | ||
@@ -17,0 +19,0 @@ |
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
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
1036180
147
9
176
1