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

express-async-await

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-async-await - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

12

example.js

@@ -29,2 +29,14 @@ let expressaa = require('./index.js')

app.get('/ok-middleware', function(req, res, next) {
next();
}, async function(req, res, next) {
res.json({hello: 'world'})
})
app.get('/no-middleware', function(req, res, next) {
next();
}, async function(req, res, next) {
throw new Error('123');
})
app.use((err, req, res, next) => {

@@ -31,0 +43,0 @@ console.error(err)

14

index.js

@@ -11,11 +11,15 @@ const wrapAsync = fn => (...args) => {

app[m.toLowerCase()] = function(...args) {
if (typeof args[1] === 'function') {
args[1] = wrapAsync(args[1])
}
const wrappedArgs = args.map(arg => {
if (typeof arg === 'function') {
return wrapAsync(arg);
}
return original.call(app, ...args)
return arg;
});
return original.call(app, ...wrappedArgs);
}
})
});
return app
}
{
"name": "express-async-await",
"version": "1.0.1",
"version": "1.1.0",
"description": "",

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

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