Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@digifi/acorn-globals

Package Overview
Dependencies
Maintainers
5
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@digifi/acorn-globals - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

37

index.js

@@ -34,6 +34,13 @@ 'use strict';

try {
return acorn.parse(source, parseOptions);
const acornParseResult = acorn.parse(source, parseOptions);
return {
ast: acornParseResult,
};
} catch (err) {
if (fallbackToLoose) {
return acornLoose.parse(source, parseOptions);
return {
ast: acornLoose.parse(source, parseOptions),
parsingError: err.message,
};
}

@@ -45,3 +52,3 @@

function findGlobals(source, options) {
function parseWithGlobals(source, options, fallbackToLoose) {
options = options || {};

@@ -52,8 +59,6 @@

// istanbul ignore else
if (typeof source === 'string') {
ast = reallyParse(source, options);
} else {
ast = source;
}
const {
ast,
parsingError,
} = (typeof source === 'string') ? reallyParse(source, options, fallbackToLoose) : { ast: source };

@@ -227,9 +232,13 @@ // istanbul ignore if

});
return Object.keys(groupedGlobals).sort().map(function (name) {
return {name: name, nodes: groupedGlobals[name]};
});
return {
ast,
globals: Object.keys(groupedGlobals).sort().map((name) => ({
name, nodes: groupedGlobals[name],
})),
parsingError,
};
}
module.exports = findGlobals;
module.exports = parseWithGlobals;
module.exports.parse = reallyParse;
{
"name": "@digifi/acorn-globals",
"version": "1.0.1",
"version": "1.0.2",
"description": "Detect global variables in JavaScript using acorn for DigiFi",

@@ -22,4 +22,3 @@ "keywords": [

"acorn-loose": "^8.1.0",
"acorn-walk": "^7.1.1",
"esprima-fb": "^15001.1001.0-dev-harmony-fb"
"acorn-walk": "^7.1.1"
},

@@ -26,0 +25,0 @@ "devDependencies": {

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