source: frontend/node_modules/acorn-globals/README.md

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.8 KB
Line 
1# acorn-globals
2
3Detect global variables in JavaScript using acorn
4
5[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)
6
7[![Build Status](https://img.shields.io/travis/ForbesLindesay/acorn-globals/master.svg)](https://travis-ci.org/ForbesLindesay/acorn-globals)
8[![Dependency Status](https://img.shields.io/david/ForbesLindesay/acorn-globals.svg)](https://david-dm.org/ForbesLindesay/acorn-globals)
9[![NPM version](https://img.shields.io/npm/v/acorn-globals.svg)](https://www.npmjs.org/package/acorn-globals)
10
11## Installation
12
13 npm install acorn-globals
14
15## Usage
16
17detect.js
18
19```js
20var fs = require('fs');
21var detect = require('acorn-globals');
22
23var src = fs.readFileSync(__dirname + '/input.js', 'utf8');
24
25var scope = detect(src);
26console.dir(scope);
27```
28
29input.js
30
31```js
32var x = 5;
33var y = 3, z = 2;
34
35w.foo();
36w = 2;
37
38RAWR=444;
39RAWR.foo();
40
41BLARG=3;
42
43foo(function () {
44 var BAR = 3;
45 process.nextTick(function (ZZZZZZZZZZZZ) {
46 console.log('beep boop');
47 var xyz = 4;
48 x += 10;
49 x.zzzzzz;
50 ZZZ=6;
51 });
52 function doom () {
53 }
54 ZZZ.foo();
55
56});
57
58console.log(xyz);
59```
60
61output:
62
63```
64$ node example/detect.js
65[ { name: 'BLARG', nodes: [ [Object] ] },
66 { name: 'RAWR', nodes: [ [Object], [Object] ] },
67 { name: 'ZZZ', nodes: [ [Object], [Object] ] },
68 { name: 'console', nodes: [ [Object], [Object] ] },
69 { name: 'foo', nodes: [ [Object] ] },
70 { name: 'process', nodes: [ [Object] ] },
71 { name: 'w', nodes: [ [Object], [Object] ] },
72 { name: 'xyz', nodes: [ [Object] ] } ]
73```
74
75## Security contact information
76
77To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
78
79## License
80
81 MIT
Note: See TracBrowser for help on using the repository browser.