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

@swyftx/express-unless-and

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swyftx/express-unless-and - npm Package Compare versions

Comparing version 1.0.0 to 1.0.2

7

package.json
{
"name": "@swyftx/express-unless-and",
"description": "Conditionally add a middleware to express with some common patterns.",
"version": "1.0.0",
"version": "1.0.2",
"license": "MIT",

@@ -42,3 +42,6 @@ "repository": {

},
"homepage": "https://github.com/Swyftx/express-unless-and#readme"
"homepage": "https://github.com/Swyftx/express-unless-and#readme",
"publishConfig": {
"access": "public"
}
}

@@ -1,6 +0,6 @@

Conditionally skip a middleware when a condition is met.
Conditionally skip a middleware when a condition is met. Conditions are ANDed instead of ORed like [express-unless](https://www.npmjs.com/package/express-unless).
## Install
npm i express-unless --save
npm i express-unless-and --save

@@ -12,9 +12,8 @@ ## Usage

```javascript
var unless = require('express-unless');
const unless = require('express-unless-and')
const static = express.static(__dirname + '/public')
static.unless = unless
var static = express.static(__dirname + '/public');
static.unless = unless;
app.use(static.unless({ method: 'OPTIONS' }));
app.use(static.unless({ method: 'OPTIONS' }))
```

@@ -26,10 +25,10 @@

module.exports = function (middlewareOptions) {
var mymid = function (req, res, next) {
let mymid = function (req, res, next) {
};
}
mymid.unless = require('express-unless');
mymid.unless = require('express-unless-and')
return mymid;
};
return mymid
}
```

@@ -59,9 +58,9 @@

Avoid a fstat for request to routes doesnt end with a given extension.
Avoid an fstat for request to routes that don't end with a given extension.
```javascript
app.use(static.unless(function (req) {
var ext = url.parse(req.originalUrl).pathname.substr(-4);
return !~['.jpg', '.html', '.css', '.js'].indexOf(ext);
}));
let ext = url.parse(req.originalUrl).pathname.substr(-4)
return !~['.jpg', '.html', '.css', '.js'].indexOf(ext)
}))
```

@@ -68,0 +67,0 @@

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