acorn-globals

WebJar for acorn-globals

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

acorn-globals
Last Version

Last Version

6.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

acorn-globals
WebJar for acorn-globals
Project URL

Project URL

https://www.webjars.org
Source Code Management

Source Code Management

https://github.com/ForbesLindesay/acorn-globals

Download acorn-globals

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/acorn-globals/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>acorn-globals</artifactId>
    <version>6.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/acorn-globals/
implementation 'org.webjars.npm:acorn-globals:6.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/acorn-globals/
implementation ("org.webjars.npm:acorn-globals:6.0.0")
'org.webjars.npm:acorn-globals:jar:6.0.0'
<dependency org="org.webjars.npm" name="acorn-globals" rev="6.0.0">
  <artifact name="acorn-globals" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='acorn-globals', version='6.0.0')
)
libraryDependencies += "org.webjars.npm" % "acorn-globals" % "6.0.0"
[org.webjars.npm/acorn-globals "6.0.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.webjars.npm : acorn jar [7.1.1,8)
org.webjars.npm : acorn-walk jar [7.1.1,8)

Project Modules

There are no modules declared in this project.

acorn-globals

Detect global variables in JavaScript using acorn

Get supported acorn-globals with the Tidelift Subscription

Build Status Dependency Status 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

Versions

Version
6.0.0
4.3.4
4.3.2
4.3.0
4.1.0
4.0.0
3.1.0
2.0.0
1.0.9
1.0.4