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

@vue-storefront/middleware

Package Overview
Dependencies
Maintainers
6
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vue-storefront/middleware - npm Package Compare versions

Comparing version 2.3.4 to 2.4.0

__tests__/helpers/getAgnosticStatusCode.spec.ts

21

lib/index.cjs.js

@@ -119,2 +119,21 @@ 'use strict';

var getAgnosticStatusCode = function (obj) {
var searchedKeys = [];
for (var _i = 1; _i < arguments.length; _i++) {
searchedKeys[_i - 1] = arguments[_i];
}
if (!obj || typeof obj !== 'object')
return;
for (var _a = 0, _b = Object.keys(obj); _a < _b.length; _a++) {
var key = _b[_a];
if (searchedKeys.includes(key)) {
return obj[key];
}
var statusCode = getAgnosticStatusCode.apply(void 0, __spreadArray([obj[key]], searchedKeys));
if (statusCode) {
return statusCode;
}
}
};
var app = express();

@@ -151,3 +170,3 @@ app.use(express.json());

error_1 = _c.sent();
res.status(500);
res.status(getAgnosticStatusCode(error_1, 'status', 'statusCode') || 500);
res.send(error_1);

@@ -154,0 +173,0 @@ return [3 /*break*/, 4];

@@ -113,2 +113,21 @@ import express from 'express';

var getAgnosticStatusCode = function (obj) {
var searchedKeys = [];
for (var _i = 1; _i < arguments.length; _i++) {
searchedKeys[_i - 1] = arguments[_i];
}
if (!obj || typeof obj !== 'object')
return;
for (var _a = 0, _b = Object.keys(obj); _a < _b.length; _a++) {
var key = _b[_a];
if (searchedKeys.includes(key)) {
return obj[key];
}
var statusCode = getAgnosticStatusCode.apply(void 0, __spreadArray([obj[key]], searchedKeys));
if (statusCode) {
return statusCode;
}
}
};
var app = express();

@@ -145,3 +164,3 @@ app.use(express.json());

error_1 = _c.sent();
res.status(500);
res.status(getAgnosticStatusCode(error_1, 'status', 'statusCode') || 500);
res.send(error_1);

@@ -148,0 +167,0 @@ return [3 /*break*/, 4];

2

package.json
{
"name": "@vue-storefront/middleware",
"version": "2.3.4",
"version": "2.4.0",
"description": "",

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

@@ -7,2 +7,3 @@ import express, { Request, Response, Express } from 'express';

import { registerIntegrations } from './integrations';
import getAgnosticStatusCode from './helpers/getAgnosticStatusCode';

@@ -46,4 +47,3 @@ const app = express();

} catch (error) {
res.status(500);
res.status(getAgnosticStatusCode(error, 'status', 'statusCode') || 500);
res.send(error);

@@ -50,0 +50,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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