Socket
Socket
Sign inDemoInstall

ast-scope

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ast-scope - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

5

lib/reference.js

@@ -13,3 +13,3 @@ var Variable = require('./variable');

this.scope = scope;
this.variable = scope.resolveVariable(Variable.extractName(node));
this.variable = scope.resolveVariable(Variable.extractId(node));
if (this.variable) {

@@ -23,5 +23,6 @@ this.variable.references.push(this);

case 'Identifier':
case 'MemberExpression':
case 'ThisExpression':
return true;
case 'MemberExpression':
return Reference.isRequired(node.object);
case 'CallExpression':

@@ -28,0 +29,0 @@ case 'NewExpression':

9

lib/variable.js

@@ -15,15 +15,14 @@

Variable.extractName = function(node) {
Variable.extractId = function(node) {
switch (node.type) {
case 'Identifier':
return node.name;
case 'ThisExpression':
return 'this';
return node;
case 'MemberExpression':
return Variable.extractName(node.object);
return Variable.extractId(node.object);
case 'CallExpression':
case 'NewExpression':
return Variable.extractName(node.callee);
return Variable.extractId(node.callee);
}
throw new Error('Invalid node type: ' + node.type);
};
{
"name": "ast-scope",
"version": "0.1.1",
"version": "0.1.2",
"description": "A JavaScript AST scope analyzer",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc