lambda-wrap
Advanced tools
Comparing version 1.0.1 to 1.0.3
'use strict'; | ||
const wrapError = require('./lib/error'); | ||
const { LambdaWrap } = require('./lib/lambda-wrap'); | ||
const error = require('./lib/error'); | ||
const LambdaWrap = require('./lib/lambdaWrap'); | ||
module.exports = { LambdaWrap, wrapError }; | ||
module.exports = { LambdaWrap, error }; |
'use strict'; | ||
/** | ||
* Return new error object. | ||
* | ||
* @param {string} message - Error message. | ||
* @param {integer} code - Error code. | ||
*/ | ||
const error = (message, code) => { | ||
@@ -4,0 +10,0 @@ const err = new Error(message); |
@@ -14,3 +14,3 @@ 'use strict'; | ||
Object.assign(headers, TEXT_TYPE); | ||
} else if (typeof data === 'object' && data.statusCode) { | ||
} else if (typeof data === 'object') { | ||
Object.assign(headers, JSON_TYPE); | ||
@@ -21,8 +21,7 @@ } else { | ||
const res = { | ||
statusCode: data.statusCode || 200, | ||
body: JSON.stringify(data), | ||
headers | ||
}; | ||
const statusCode = data.statusCode || 200; | ||
const body = JSON.stringify(data.body); | ||
const res = { statusCode, body }; | ||
logger.log(res); | ||
@@ -29,0 +28,0 @@ |
{ | ||
"name": "lambda-wrap", | ||
"version": "1.0.1", | ||
"version": "1.0.3", | ||
"description": "", | ||
@@ -12,3 +12,4 @@ "main": "index.js", | ||
"test:coverage:threshold": "node ./node_modules/.bin/istanbul check", | ||
"test:lint": "eslint ./lib/**/*.js ./test/**/*.js" | ||
"test:lint": "eslint ./lib/**/*.js ./test/**/*.js", | ||
"doc:generate": "node ./bin/makeApiDoc.js" | ||
}, | ||
@@ -31,2 +32,3 @@ "author": "Pragonauts <lukas.hykl@pragonauts.com> (https://pragonauts.com)", | ||
"istanbul": "^0.4.5", | ||
"jsdoc-to-markdown": "^4.0.1", | ||
"mocha": "^4.0.1", | ||
@@ -33,0 +35,0 @@ "mocha-istanbul": "^0.3.0" |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
124078
17
3511
1
140
13
2
1