Detect Global Variables in JavaScript ASTs
JSON →acorn-globals is a utility for identifying global variable references within JavaScript code by leveraging the Acorn AST parser. It traverses the Abstract Syntax Tree (AST) generated by Acorn to distinguish between locally declared variables and those that implicitly refer to the global scope. The package is currently at version 7.0.1 and appears to maintain an active release cadence, primarily driven by updates to its underlying Acorn dependency and bug fixes related to scope resolution (e.g., switch statement bodies, catch handlers). Its key differentiator is its focus solely on global variable detection based on AST analysis, providing precise lexical scope information without performing any runtime evaluation. It is particularly useful for static analysis tools, linters, and bundlers that need to understand variable leakage or undeclared globals.
Traffic · last 30 days ↓21% vs prev 7d
top countries 🇺🇸 United States · 🇸🇬 Singapore · 🇩🇪 Germany · 🇨🇦 Canada · VN