ast-module-types
Advanced tools
Comparing version 2.1.0 to 2.2.0
@@ -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'; | ||
}; |
{ | ||
"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)); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10671
5
209
42