🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

add-variable-declarations

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

add-variable-declarations - npm Package Compare versions

Comparing version

to
1.5.0

34

dist/add-variable-declarations.es.js

@@ -49,7 +49,5 @@ import MagicString from 'magic-string';

this.names = new Set();
this.globals = new Map();
this.scope = scope;
this.parentState = parentState;
this.collectGlobals(scope);
}

@@ -63,8 +61,2 @@

}
var global = this.getGlobal(node.name);
if (global && global.start < node.start) {
// Anything that is referenced before being assigned is really, truly, a
// global and should not be converted to a local variable.
return;
}
this.bindingIdentifiers.add(node);

@@ -90,28 +82,2 @@ this.names.add(node.name);

}
}, {
key: 'getGlobal',
value: function getGlobal(name) {
var state = this;
do {
var global = state.globals.get(name);
if (global) {
return global;
}
} while (state = state.parentState);
return null;
}
/**
* @private
*/
}, {
key: 'collectGlobals',
value: function collectGlobals(scope) {
var _this = this;
Object.keys(scope.globals).forEach(function (name) {
return _this.globals.set(name, scope.globals[name]);
});
}
}]);

@@ -118,0 +84,0 @@ return TraverseState;

@@ -54,7 +54,5 @@ (function (global, factory) {

this.names = new Set();
this.globals = new Map();
this.scope = scope;
this.parentState = parentState;
this.collectGlobals(scope);
}

@@ -68,8 +66,2 @@

}
var global = this.getGlobal(node.name);
if (global && global.start < node.start) {
// Anything that is referenced before being assigned is really, truly, a
// global and should not be converted to a local variable.
return;
}
this.bindingIdentifiers.add(node);

@@ -95,28 +87,2 @@ this.names.add(node.name);

}
}, {
key: 'getGlobal',
value: function getGlobal(name) {
var state = this;
do {
var global = state.globals.get(name);
if (global) {
return global;
}
} while (state = state.parentState);
return null;
}
/**
* @private
*/
}, {
key: 'collectGlobals',
value: function collectGlobals(scope) {
var _this = this;
Object.keys(scope.globals).forEach(function (name) {
return _this.globals.set(name, scope.globals[name]);
});
}
}]);

@@ -123,0 +89,0 @@ return TraverseState;

5

package.json
{
"name": "add-variable-declarations",
"version": "1.4.0",
"version": "1.5.0",
"description": "Add variable declarations for global assignments.",

@@ -50,3 +50,6 @@ "main": "dist/add-variable-declarations.umd.js",

"magic-string": "^0.10.2"
},
"publishConfig": {
"registry": "https://registry.npmjs.org/"
}
}