From e2c0949dd5b9c39fe0b9253787cb2251dd42bfe8 Mon Sep 17 00:00:00 2001 From: Axel Kittenberger Date: Tue, 28 Mar 2023 14:41:35 +0200 Subject: [PATCH] transcontextual safe type checks --- lib/server.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/server.js b/lib/server.js index 30af2e3..fa0f828 100644 --- a/lib/server.js +++ b/lib/server.js @@ -47,15 +47,15 @@ function mergeFunctionArgs (argv, start, end) { const handlers = [] for (let i = start; i < end; i++) { - if (argv[i] instanceof Array) { + if (Array.isArray(argv[i])) { const arr = argv[i] for (let j = 0; j < arr.length; j++) { - if (!(arr[j] instanceof Function)) { + if ((typeof arr[j] !== 'function')) { throw new TypeError('Invalid argument type: ' + typeof (arr[j])) } handlers.push(arr[j]) } - } else if (argv[i] instanceof Function) { + } else if (typeof argv[i] === 'function') { handlers.push(argv[i]) } else { throw new TypeError('Invalid argument type: ' + typeof (argv[i]))