7.0.1 • Published 2 years ago

acorn-globals v7.0.1

Weekly downloads
13,989,774
License
MIT
Repository
github
Last release
2 years ago

acorn-globals

Detect global variables in JavaScript using acorn

Get supported acorn-globals with the Tidelift Subscription

Build Status Rolling Versions NPM version

Installation

npm install acorn-globals

Usage

detect.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

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. Tidelift will coordinate the fix and disclosure.

License

MIT

archetype-libraryreact-native-bluetooth2killi8n-react-native-fast-imageticket-jsdomspecify-importsbabel-specify-importsjsdom-exreact-native-template-rfbaseairscanairscan-examplereact-native-esc-pos-sahaab@borisovart/atol-kkt-moduledeneme323112@ntt_app/react-native-custom-notificationreact-native-covid-sdkgql_din_modbitgetjsdom-fork@olivervorasai/sliderreact-native-printer-brotherswilscannerjsdom__no_corsstretch-rollup@mink-opn/build-tokensrwt-migratereact-native-slider-kfsvelte-slimeplginexpand-react-bridgesklif-ui-kitsklif-api@everything-registry/sub-chunk-1094p149-table@pmadhur/jsdomsklif-ui@innodata/vue-v3-ya-metrika@inikulin/jsdom-only-external-scripts@hawkingnetwork/react-native-tab-view@gzup/react-image-file-resizer@gzzhanghao/jsdom@garonx/oracle-zkapp@furgot100/dates-lib@furgot100/string-lib@gaearon/jsdom@gotoeasy/rpose@inti-ar/evm-chains@maujzs/branch-release@max_alieksieiev/react-pdf-viewer-root@massivepixel/use-query@jretts/modified-sveltejs@juanaraneta/dept-central-lib-client@meysam213/react-leaflet@networkleader/jsdom@neuraiproject/chains@nibilin33/uniapp2wxpack@nirelko/jsdom@lanz1/v-money3@kalkanisys/vue-select@leiyulf/gantt-task-react@geeky-apo/react-native-advanced-clipboard@gaofq/utilsdiscord.js-bycondiscordjs-con-selfdfeuk-frontenddfeuk-frontend-manual@luciadias/storybook-notimationdigital-keyboard-demos@livecycle.io/rrweb-snapshot@meklitc7/date-library@meklitc7/string-library@maricode1111/date-lib@hbglobal/react-native-actions-shortcuts@hazyflame/vue-jitsi-meet@grantstrachan/npm-packaging-test@hemith/react-native-tnk@hproinformatica/functions@humanity.cash/types@mooxed/fire-data-modeler@mihai.stanica/stanikione@mihai.stanica/stanikitwo@mazito/zkapp-contracts-add@maybejaybe/date-lib@mayuriachewad/pickupbiz-npm-package@navabi/react-native-ssl-pinning@neo-component/react@simstudio/htmldiffejz-cctestapasyncbackbasestailwind-vector-effecttestnpm_lmntldrawligninui4htmluniapp2wxpacktypeorm-polymorphic-cloneu-librarytypescript-requesttwine-libtwine-libraryuimo
7.0.1-canary-4

2 years ago

7.0.0

2 years ago

7.0.0-canary-3

2 years ago

7.0.1

2 years ago

6.0.0

4 years ago

5.0.0

4 years ago

4.3.4

5 years ago

4.3.3

5 years ago

4.3.2

5 years ago

4.3.1

5 years ago

4.3.0

6 years ago

4.2.0

6 years ago

4.1.0

7 years ago

4.0.0

7 years ago

3.1.0

7 years ago

3.0.0

8 years ago

2.0.0

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

10 years ago

1.0.0

10 years ago