Socket
Socket
Sign inDemoInstall

ast-module-types

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ast-module-types - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

10

index.js

@@ -21,2 +21,10 @@ // Whether or not the node represents an AMD define() call

// Whether or not the node represents a require at the top of the module
// This occurs when the module is an initialization (driver) script
module.exports.isTopLevelRequire = function (node) {
// If there's a require, it's either the top-level or nested
// at which it still has at least 3 parents
return types.isRequire(node) && node.parent.parent.parent.type === 'Program';
};
// Whether or not the node represents the use of

@@ -62,2 +70,2 @@ // assigning something to module.exports or exports

return args && args[0].type === 'ObjectExpression';
};
};

2

package.json
{
"name": "ast-module-types",
"version": "1.0.0",
"version": "1.1.0",
"description": "Collection of useful helper functions when trying to determine module type (CommonJS or AMD) properties of an AST node.",

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

@@ -15,2 +15,3 @@ Collection of useful helper functions when trying to determine

* `isRequire`: if node matches a `require` function all (declaring a dependency)
* `isTopLevelRequire`: if node matches a `require` at the top of the file. App initialization (aka driver) scripts have this.
* `isExports`: if the node matches CommonJS `module.exports` or `exports` (defining a module)

@@ -17,0 +18,0 @@

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