Comparing version 0.1.0 to 0.1.1
@@ -29,2 +29,9 @@ | ||
} | ||
if (this.left.type !== 'Identifier') return; | ||
this.variable = scope.resolveVariable(this.left); | ||
if (this.variable) { | ||
this.variable.assignments.push(this); | ||
} | ||
} | ||
@@ -31,0 +38,0 @@ |
@@ -67,9 +67,2 @@ var estraverse = require('estraverse'); | ||
this.assignments.push(assignment); | ||
if (assignment.left.type !== 'Identifier') return; | ||
var variable = this.resolveVariable(assignment.left); | ||
if (variable) { | ||
variable.assignments.push(assignment); | ||
} | ||
}; | ||
@@ -76,0 +69,0 @@ |
{ | ||
"name": "ast-scope", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A JavaScript AST scope analyzer", | ||
"keywords": [ | ||
"ast", | ||
"esprima", | ||
"scope", | ||
"analyze" | ||
], | ||
"scripts": { | ||
"test": "node_modules/.bin/mocha --reporter dot" | ||
"test": "mocha --reporter dot" | ||
}, | ||
"author": "", | ||
"author": "Naoyuki Kanezawa <naoyuki.kanezawa@gmail.com>", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/nkzawa/ast-scope.git" | ||
}, | ||
"dependencies": { | ||
@@ -11,0 +21,0 @@ "estraverse": "~1.5.0" |
@@ -6,4 +6,19 @@ ast-scope | ||
A JavaScript AST scope analyzer | ||
A JavaScript AST scope analyzer. The module is heavily inspired by [escope](https://github.com/Constellation/escope). | ||
The module is heavily inspired by [escope](https://github.com/Constellation/escope). | ||
## Installation | ||
$ npm install ast-scope | ||
## Usage | ||
```js | ||
var esprima = require('esprima'); | ||
var as = require('ast-scope'); | ||
var ast = esprima.parse('var foo = function() {};'); | ||
var topScope = as.analyze(ast); | ||
``` | ||
## License | ||
MIT |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
2
24
0
11014
11
330