acorn-globals
Detect global variables in JavaScript using acorn
Last updated 2 years ago by acorn-globals-bot .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install acorn-globals 
SYNC missed versions from official npm registry.

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

Current Tags

  • 7.0.1-canary-4                                ...           canary (2 years ago)
  • 7.0.1                                ...           latest (2 years ago)

27 Versions

  • 7.0.1                                ...           2 years ago
  • 7.0.1-canary-4                                ...           2 years ago
  • 7.0.0                                ...           2 years ago
  • 7.0.0-canary-3                                ...           2 years ago
  • 6.0.0                                ...           5 years ago
  • 5.0.0                                ...           5 years ago
  • 4.3.4                                ...           5 years ago
  • 4.3.3                                ...           5 years ago
  • 4.3.2                                ...           6 years ago
  • 4.3.1                                ...           6 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                                ...           8 years ago
  • 3.0.0                                ...           9 years ago
  • 2.0.0                                ...           9 years ago
  • 1.0.9                                ...           9 years ago
  • 1.0.8                                ...           9 years ago
  • 1.0.7                                ...           9 years ago
  • 1.0.6                                ...           9 years ago
  • 1.0.5                                ...           9 years ago
  • 1.0.4                                ...           10 years ago
  • 1.0.3                                ...           10 years ago
  • 1.0.2                                ...           10 years ago
  • 1.0.1                                ...           10 years ago
  • 1.0.0                                ...           10 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (1)
Dependents (3)

Copyright 2013 - present © cnpmjs.org | Home |