acorn-globals
Detect global variables in JavaScript using acorn
Get supported acorn-globals with the Tidelift Subscription
Installation
npm install acorn-globals
Usage
detect.js
var fs = ;var detect = ; var src = fs; var scope = ;consoledirscope;
input.js
var x = 5;var y = 3 z = 2; w;w = 2; RAWR=444;RAWR; BLARG=3; ; console;
output:
$ node example/detect.js
[ { name: 'BLARG', nodes: [ [Object] ] },
{ name: 'RAWR', nodes: [ [Object], [Object] ] },
{ name: 'ZZZ', nodes: [ [Object], [Object] ] },
{ name: 'console', nodes: [ [Object], [Object] ] },
{ name: 'foo', nodes: [ [Object] ] },
{ name: 'process', nodes: [ [Object] ] },
{ name: 'w', nodes: [ [Object], [Object] ] },
{ name: 'xyz', nodes: [ [Object] ] } ]
Security contact information
To report a security vulnerability, please use the Tidelift security contact. Tidelift will coordinate the fix and disclosure.
License
MIT