<commit_before># summon-middleware
### Dinamically enable or disable express middleware

This wrapper allow you to dinamically enable or disable an express or connect middleware.
In some circumstances you would use a middleware only if some conditions are
met.

#### Installation
If you want use summon-middleware you have to install it. There are two methods to do that:

In your package.json add the following item:
```json
"summon-middleware": "version"
```
then digit:
```console
npm install
```
**Example**:
```json
"summon-middleware": "*" for the latest version
"summon-middleware": "1.0.0" for the version 1.0.0
```

**OR**

launch this command:
```console
npm install summon-middleware --save
```
#### Use
```javascript
summonMiddleware(<Your Express or Connect Middleware>, <predicate>);
```

```javascript
var summonMiddleware = require('summon-middleware');

// Import some other required modules
var express = require('express');
var app = express();
var responsePoweredBy = require('response-powered-by');
var POWERED_BY = "@NIckNaso";
// Some other configuration for the express app and session

// predicate as function
app.use(summonMiddleware(
  responsePoweredBy(POWERED_BY),
  function () {
    // some other instructions ...
    return true;
  }
));
```
The first parameter for summon-middleware is an express or connect middleware, while the<commit_msg>Updated readme.<commit_after># summon-middleware
### Dinamically enable or disable express middleware

This wrapper allow you to dinamically enable or disable an express or connect middleware.
In some circumstances you would use a middleware only if some conditions are
met.

#### Installation
If you want use summon-middleware you have to install it. There are two methods to do that:

In your package.json add the following item:
```json
"summon-middleware": "version"
```
then digit:
```console
npm install
```
**Example**:
```json
"summon-middleware": "*" for the latest version
"summon-middleware": "1.0.0" for the version 1.0.0
```

**OR**

launch this command:
```console
npm install summon-middleware --save
```
#### Use
```javascript
summonMiddleware(<Your Express or Connect Middleware>, <predicate>);
```

```javascript
var summonMiddleware = require('summon-middleware');

// Import some other required modules
var express = require('express');
var app = express();
var responsePoweredBy = require('response-powered-by');
var POWERED_BY = "@NickNaso";
// Some other configuration for the express app and session

// predicate as function
app.use(summonMiddleware(
  responsePoweredBy(POWERED_BY),
  function () {
    // some instructions...
    if (<Your condition>) {
      return true;
    }
    return false;
  }
));
```
The first parameter for summon-middleware is an express or connect middleware, while the
{'fraction_non_alphanumeric': 0.11789924973204716, 'fraction_numerical': 0.004287245444801715, 'mean_word_length': 4.809128630705394, 'pattern_counts': {'":': 6, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5462135', 'n_tokens_mistral': 807, 'n_tokens_neox': 776, 'n_words': 310}