We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0c674bd commit 6781d9bCopy full SHA for 6781d9b
src/utils/compose-middleware.js
@@ -1,10 +1,12 @@
1
+const isFunction = fn => typeof fn === 'function'
2
+
3
export default function composeMiddleware (middleware) {
4
if (!Array.isArray(middleware)) {
5
throw new TypeError('Middleware stack must be an array!')
6
}
7
8
for (const fn of middleware) {
- if (typeof fn !== 'function') {
9
+ if (!isFunction(fn)) {
10
throw new TypeError('Middleware must be composed of functions!')
11
12
@@ -28,7 +30,7 @@ export default function composeMiddleware (middleware) {
28
30
fn = next
29
31
32
- if (!fn || typeof fn !== 'function') {
33
+ if (!fn || !isFunction(fn)) {
34
return Promise.resolve()
35
36
0 commit comments