云盘
志元云盘
备份云盘
Home
/
志元云盘
/
webdav
/
hexo
/
hexo-blog
/
node_modules
/
acorn-globals
File
OriginalPic
Thumbnails
CopyAllDownloadUrl
EditTime
Size
index.js
2023-11-13 01:33:42
5.59 KB
LICENSE
2023-11-13 01:33:42
1.03 KB
package.json
2023-11-13 01:33:42
627 B
README.md
2023-11-13 01:33:42
1.99 KB
# acorn-globals Detect global variables in JavaScript using acorn [Get supported acorn-globals with the Tidelift Subscription](https://tidelift.com/subscription/pkg/npm-acorn_globals?utm_source=npm-acorn-globals&utm_medium=referral&utm_campaign=readme) [](https://github.com/ForbesLindesay/acorn-globals/actions?query=workflow%3APublish%20Canary+branch%3Amaster) [](https://rollingversions.com/ForbesLindesay/acorn-globals) [](https://www.npmjs.com/package/acorn-globals) ## Installation npm install acorn-globals ## Usage detect.js ```js var fs = require('fs'); var detect = require('acorn-globals'); var src = fs.readFileSync(__dirname + '/input.js', 'utf8'); var scope = detect(src); console.dir(scope); ``` input.js ```js var x = 5; var y = 3, z = 2; w.foo(); w = 2; RAWR=444; RAWR.foo(); BLARG=3; foo(function () { var BAR = 3; process.nextTick(function (ZZZZZZZZZZZZ) { console.log('beep boop'); var xyz = 4; x += 10; x.zzzzzz; ZZZ=6; }); function doom () { } ZZZ.foo(); }); console.log(xyz); ``` 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](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. ## License MIT
2025-08-29 16:32:56 Friday 216.73.216.167 Runningtime:0.026s Mem:1.48 MB