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

attach-ware

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

attach-ware - npm Package Compare versions

Comparing version 1.1.1 to 2.0.0

5

history.md

@@ -5,2 +5,7 @@ <!--remark setext-->

2.0.0 / 2016-02-12
==================
* Add support for `list`, `matrix` of attachers ([`c77680a`](https://github.com/wooorm/attach-ware/commit/c77680a))
1.1.1 / 2016-02-12

@@ -7,0 +12,0 @@ ==================

45

index.js

@@ -83,23 +83,2 @@ /**

/*
* Accept other `AttachWare`.
*/
if (attach instanceof AttachWare) {
if (attach.attachers) {
return self.use(attach.attachers);
}
return self;
}
/*
* Accept normal ware.
*/
if (attach instanceof Ware) {
self.fns = self.fns.concat(attach.fns);
return self;
}
/*
* Multiple attachers.

@@ -112,4 +91,24 @@ */

while (++index < length) {
self.use.apply(self, [attach[index]].concat(params));
/*
* So, `attach[0]` is a function, meaning its
* either a list of `attachers` or its a `list`.
*/
if (typeof attach[0] === 'function') {
if (
(attach[1] !== null && attach[1] !== undefined) &&
typeof attach[1] !== 'function'
) {
self.use.apply(self, attach);
} else {
while (++index < length) {
self.use.apply(self, [
attach[index]
].concat(params));
}
}
} else {
while (++index < length) {
self.use(attach[index]);
}
}

@@ -116,0 +115,0 @@

{
"name": "attach-ware",
"version": "1.1.1",
"version": "2.0.0",
"description": "Middleware with configuration",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -77,7 +77,26 @@ # attach-ware [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov]

### `AttachWare#use(attach[, input...])`
### `AttachWare#use(attacher[, input...])`
Invokes `attach` with [`context`][context] and all `input`.
**Signatures**:
If `attach` returns another function (`fn`, which can be synchronous,
* `attachWare.use(attacher[, input...])`;
* `attachWare.use(attachers[, input...])`;
* `attachWare.use(list)`;
* `attachWare.use(matrix)`.
**Parameters**:
* `attacher` (`Function`) — One attacher.
* `attachers` (`Array.<Function>`) — List where each value is an
`attacher`;
* `list` (`Array`) — List where the first value is an `attacher`,
and further values are `input`;
* `matrix` (`Array`) — Matrix where each entry is a `list`.
Invokes `attacher` with [`context`][context] and all `input`.
If `attacher` returns another function (`fn`, which can be synchronous,
asynchronous, or a generator function), that function is [added to the

@@ -84,0 +103,0 @@ middleware][ware-use], and will be invoked when [`run()`][ware-run] is

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