Socket
Socket
Sign inDemoInstall

middl

Package Overview
Dependencies
6
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.0 to 0.2.1

2

package.json
{
"name": "middl",
"version": "0.2.0",
"version": "0.2.1",
"description": "A generic middleware library, inspired by Express and suitable for anything",

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

@@ -5,3 +5,3 @@ # middl

[![Build status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![NPM version][npm-image]][npm-url] [![js-xo-style][codestyle-image]][codestyle-url]
[![Build status][travis-image]][travis-url] [![Coverage Status][coveralls-image]][coveralls-url] [![NPM version][npm-image]][npm-url] [![XO code style][codestyle-image]][codestyle-url]

@@ -167,3 +167,3 @@ > A generic middleware library, inspired by Express and suitable for anything

|------|------|-------------|
| conditions | `Object` | The middleware will only be run if the current `input` matches this object |
| conditions | `Object` | The middleware will only be run if the current `input` [matches](#how-the-conditions-are-matched) this object |
| path | `String` | An optional mount path for the middleware (only applicable if [`options.pathProperty`](#optionspathproperty) is set) |

@@ -184,2 +184,12 @@ | fn | `Function` | The middleware function |

##### How the conditions are matched
Each [own property](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty) of the `conditions` object are matched with the property with the same name in `input`, in the following way:
If `conditions[property]` is a:
* **regular expression**: `input[property]` must match the regular expression
* **function**: the function will be called with `input[property]` as argument and should return a `boolean` indicating if the property matches (`true`) or not (`false`)
* _**otherwise**_: `input[property]` must equal (`===`) `conditions[property]`
## License

@@ -196,2 +206,2 @@

[codestyle-url]: https://github.com/sindresorhus/xo
[codestyle-image]: https://img.shields.io/badge/code%20style-xo-brightgreen.svg?style=flat
[codestyle-image]: https://img.shields.io/badge/code%20style-XO-5ed9c7.svg?style=flat
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc