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

express-result-types

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-result-types - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

package.json

@@ -5,3 +5,3 @@ {

"typings": "./target/index.d.ts",
"version": "0.0.1",
"version": "0.0.2",
"scripts": {

@@ -8,0 +8,0 @@ "lint": "tslint --project tsconfig.json --type-check",

/// <reference types="express" />
import * as express from 'express';
import { Result } from './result';
export declare const applyResultToExpress: ({req, res, result}: {
req: express.Request;
res: express.Response;
result: Result;
}) => void;
export declare const wrap: (fn: (req: express.Request) => Result) => express.RequestHandler;
export declare const wrapAsync: (fn: (req: express.Request) => Promise<Result>) => express.RequestHandler;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const MapHelpers = require("./helpers/map");
const applyResultToExpress = ({ req, res, result, }) => {
exports.applyResultToExpress = ({ req, res, result, }) => {
const headersStringDictionary = MapHelpers.toStringDictionary(result.header.headers);
const sessionStringDictionary = result.newSession !== undefined ? MapHelpers.toStringDictionary(result.newSession) : {};
req.session.data = sessionStringDictionary;
const maybeSessionStringDictionary = result.newSession !== undefined
? MapHelpers.toStringDictionary(result.newSession)
: undefined;
if (maybeSessionStringDictionary !== undefined) {
const sessionStringDictionary = maybeSessionStringDictionary;
req.session.data = sessionStringDictionary;
}
res

@@ -18,3 +23,3 @@ .status(result.header.status)

const result = fn(req);
applyResultToExpress({ req, res, result });
exports.applyResultToExpress({ req, res, result });
};

@@ -25,5 +30,5 @@ const wrapAsyncRequestHandler = promiseFn => (req, res, next) => promiseFn(req, res).catch(next);

return resultPromise.then(result => {
applyResultToExpress({ req, res, result });
exports.applyResultToExpress({ req, res, result });
});
});
//# sourceMappingURL=wrap.js.map

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