agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
25 lines (23 loc) • 798 B
JavaScript
/**
* @file Check if variable is a known global
* @description Single responsibility: Determine if a variable name is a known global
*/
/**
* Check if variable is a known global
*/
function isGlobalVariable(name) {
const globals = [
// Node.js globals
'window', 'document', 'console', 'process', 'global',
'require', 'module', 'exports', '__dirname', '__filename',
'Buffer', 'setImmediate', 'clearImmediate',
'setTimeout', 'clearTimeout', 'setInterval', 'clearInterval',
// Common globals
'undefined', 'null', 'NaN', 'Infinity',
'parseInt', 'parseFloat', 'isNaN', 'isFinite',
'encodeURI', 'encodeURIComponent', 'decodeURI', 'decodeURIComponent',
'escape', 'unescape', 'eval'
];
return globals.includes(name);
}
module.exports = isGlobalVariable;