Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit e2c0949

Browse files
Axel Kittenbergerjsumners
authored andcommitted
transcontextual safe type checks
1 parent 8c58f46 commit e2c0949

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/server.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ function mergeFunctionArgs (argv, start, end) {
4747
const handlers = []
4848

4949
for (let i = start; i < end; i++) {
50-
if (argv[i] instanceof Array) {
50+
if (Array.isArray(argv[i])) {
5151
const arr = argv[i]
5252
for (let j = 0; j < arr.length; j++) {
53-
if (!(arr[j] instanceof Function)) {
53+
if ((typeof arr[j] !== 'function')) {
5454
throw new TypeError('Invalid argument type: ' + typeof (arr[j]))
5555
}
5656
handlers.push(arr[j])
5757
}
58-
} else if (argv[i] instanceof Function) {
58+
} else if (typeof argv[i] === 'function') {
5959
handlers.push(argv[i])
6060
} else {
6161
throw new TypeError('Invalid argument type: ' + typeof (argv[i]))

0 commit comments

Comments
 (0)