
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
find-global-deps-souretype
Advanced tools
Find what global variables are used in js code.
For this module, a "global dependency" is a global variable used by your code that is not provided by the environment.
Maybe you want to find these and do something with webpack's imports-loader.
npm install find-global-deps
Requires node 6 or later
var findGlobalDeps = require('find-global-deps');
var code = 'let a = foo';
var result = findGlobalDeps(code);
result // Set { 'foo' }
var findGlobalDeps = require('find-global-deps');
findGlobalDeps(code[, options])
Returns a Set<string>
of names of global dependencies found.
code
String of js code.
options.environment
Optional array of strings. Defaults to ['es6', 'browser']
.
Specifies what environment code
is written for. Any use of globals that come with these environments (e.g. process
in node) will not be reported.
Can contain any top-level property names of the object exported by the globals module.
Examples
// node
findGlobalDeps(code, {
environment: ['es6', 'node']
});
// commonjs in browser
findGlobalDeps(code, {
environment: ['es6', 'browser', 'commonjs']
});
Does not detect (yet)
window.foo
in browserthis.foo
at top level in browserglobal.foo
in nodeMIT
FAQs
Find what global variables are used in js code
The npm package find-global-deps-souretype receives a total of 2 weekly downloads. As such, find-global-deps-souretype popularity was classified as not popular.
We found that find-global-deps-souretype demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.