🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

ast-module-types

Package Overview
Dependencies
Maintainers
1
Versions
23
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

to
2.2.0

.travis.yml

@@ -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));
});
});
});