Socket
Socket
Sign inDemoInstall

module-definition

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

module-definition - npm Package Compare versions

Comparing version 2.2.3 to 2.2.4

37

index.js

@@ -17,2 +17,3 @@ var Walker = require('node-source-walk');

var walker = new Walker();
var type = 'none';
var hasDefine = false;

@@ -24,5 +25,2 @@ var hasAMDTopLevelRequire = false;

var hasES6Export = false;
var isAMD;
var isCommonJS;
var isES6;

@@ -54,22 +52,23 @@ // Walker accepts as AST to avoid reparsing

}
});
isAMD = hasDefine || hasAMDTopLevelRequire;
isCommonJS = hasExports || (hasRequire && !hasDefine);
isES6 = hasES6Import || hasES6Export;
if (hasES6Import || hasES6Export) {
type = 'es6';
walker.stopWalking();
return;
}
// ES6 features are so unique that we can eagerly exit. (#19)
if (isES6) {
return 'es6';
}
if (hasDefine || hasAMDTopLevelRequire) {
type = 'amd';
walker.stopWalking();
return;
}
if (isAMD) {
return 'amd';
}
if (hasExports || (hasRequire && !hasDefine)) {
type = 'commonjs';
walker.stopWalking();
return;
}
});
if (isCommonJS) {
return 'commonjs';
}
return 'none';
return type;
}

@@ -76,0 +75,0 @@

{
"name": "module-definition",
"version": "2.2.3",
"version": "2.2.4",
"description": "Determines if a file is using a CommonJS or AMD module definition",

@@ -5,0 +5,0 @@ "main": "index.js",

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