Blame view
lib/is-valid-apikey.js
406 Bytes
b76b508a9
|
1 2 3 4 |
module.exports = (apikey, apikeys) => { if (!apikey) return false; if (typeof apikey !== 'string') return false; if (!apikeys || !Array.isArray(apikeys)) return false; |
34487543f
|
5 |
const matchedApikey = apikeys.find((item) => !item.disabled |
b76b508a9
|
6 7 8 9 |
&& ( (typeof item === 'string' && item === apikey) || (item.value === apikey) )); |
0b6da0fdd
|
10 11 |
return matchedApikey || false; |
b76b508a9
|
12 |
}; |