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

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 2.1.0 to 2.2.0

.travis.yml

5

index.js

@@ -164,1 +164,6 @@ // Whether or not the node represents an AMD define() call

};
// Any form of es6 export
module.exports.isES6Export = function (node) {
return node.type === 'ExportDeclaration';
};

2

package.json
{
"name": "ast-module-types",
"version": "2.1.0",
"version": "2.2.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",

Collection of useful helper functions when trying to determine
module type (CommonJS or AMD) properties of an AST node.
**Assumes that you used Esprima to get the AST nodes.**
**AST checks are based on the Esprima (Spidermonkey) format**

@@ -30,2 +30,3 @@ `npm install ast-module-types`

* `isES6Import`: if the node is of the form: `import 'mylib'` or `import {something} from 'mylib'`
* `isES6Export`: if the node is of any es6 export form: ex: `export default 123;` or `export { D as default };`

@@ -32,0 +33,0 @@ ### Usage

@@ -90,3 +90,9 @@ var types = require('../');

});
it('detects es6 exports', function () {
assert(check('export default 123;', types.isES6Export, true));
assert(check('export { D as default };', types.isES6Export, true));
assert(check('export function inc() { counter++; }', types.isES6Export, true));
});
});
});
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