@aofl/middleware
Advanced tools
Comparing version 1.4.1 to 2.0.0-alpha.5
{ | ||
"name": "@aofl/middleware", | ||
"version": "1.4.1", | ||
"version": "2.0.0-alpha.5", | ||
"description": "Simple base middleware class", | ||
@@ -24,3 +24,3 @@ "main": "index.js", | ||
}, | ||
"gitHead": "60297b316858cd061ea1c221a7e04406b910ef38" | ||
"gitHead": "00d91514e0c953e8cd998150ed5705b87db20b39" | ||
} |
@@ -25,4 +25,4 @@ /** | ||
use(callback, hook) { | ||
if (typeof callback !== 'function') throw new Error('callback must be a function'); | ||
if (typeof this.middleware[hook] === 'undefined') throw new Error(`Only ${Object.keys(this.middleware)} hooks are supported.`); | ||
if (typeof callback !== 'function') { throw new Error('callback must be a function'); } | ||
if (typeof this.middleware[hook] === 'undefined') { throw new Error(`Only ${Object.keys(this.middleware)} hooks are supported.`); } | ||
this.middleware[hook].push({ | ||
@@ -65,3 +65,3 @@ callback, | ||
iterateMiddleware(request, hook, response = null) { | ||
return new Promise((resolve, reject) => { | ||
return new Promise((resolve) => { | ||
const iterator = this.getMiddlewareIterator(hook); | ||
@@ -68,0 +68,0 @@ let mw = null; |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
6356
3