transcontextual safe type checks

This commit is contained in:
Axel Kittenberger 2023-03-28 14:41:35 +02:00 committed by James Sumners
parent 8c58f462fc
commit e2c0949dd5
1 changed files with 3 additions and 3 deletions

View File

@ -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]))