Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@middy/util

Package Overview
Dependencies
Maintainers
3
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@middy/util - npm Package Compare versions

Comparing version 2.3.0 to 2.4.0

53

index.js

@@ -210,2 +210,52 @@ "use strict";

return response;
}; // smaller version of `http-errors`
const statuses = require('./codes.json');
const {
inherits
} = require('util');
const createErrorRegexp = /[^a-zA-Z]/g;
const createError = (code, message, properties = {}) => {
const name = statuses[code].replace(createErrorRegexp, '');
const className = name.substr(-5) !== 'Error' ? name + 'Error' : name;
function HttpError(message) {
// create the error object
const msg = message !== null && message !== void 0 ? message : statuses[code];
const err = new Error(msg); // capture a stack trace to the construction point
Error.captureStackTrace(err, HttpError); // adjust the [[Prototype]]
Object.setPrototypeOf(err, HttpError.prototype); // redefine the error message
Object.defineProperty(err, 'message', {
enumerable: true,
configurable: true,
value: msg,
writable: true
}); // redefine the error name
Object.defineProperty(err, 'name', {
enumerable: false,
configurable: true,
value: className,
writable: true
});
return err;
}
inherits(HttpError, Error);
const desc = Object.getOwnPropertyDescriptor(HttpError, 'name');
desc.value = className;
Object.defineProperty(HttpError, 'name', desc);
Object.assign(HttpError.prototype, {
status: code,
statusCode: code,
expose: code < 500
}, properties);
return new HttpError(message);
};

@@ -224,3 +274,4 @@

jsonSafeParse,
normalizeHttpResponse
normalizeHttpResponse,
createError
};

6

package.json
{
"name": "@middy/util",
"version": "2.3.0",
"version": "2.4.0",
"description": "🛵 The stylish Node.js middleware engine for AWS Lambda (util package)",

@@ -46,3 +46,3 @@ "type": "commonjs",

"devDependencies": {
"@middy/core": "^2.3.0",
"@middy/core": "^2.4.0",
"@types/aws-lambda": "^8.10.76",

@@ -54,3 +54,3 @@ "@types/node": "^15.9.0",

"homepage": "https://github.com/middyjs/middy#readme",
"gitHead": "bfde6fec04cea012747c547d0cfd44bb2ea4e1ef"
"gitHead": "d20d67c6ec1c8dc1f58b1bedbcbb71f70d302fb5"
}
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