Package Exports
- ast-test
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ast-test) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ast-test

Test source tree on some condition.
Use
$ npm install --save ast-test
var parse = require('esprima').parse;
var test = require('ast-test');
//catch all `foo` assignments
var rule = {
AssignmentExpression: function(node){
if (node.operator !== '=') return false;
return node.left.name === 'foo';
}
};
test(parse('foo = 1;').body[0], rule) //true
test(parse('var foo = 1;').body[0], rule) //false
API
test(Node, test) → Boolean
Test whether node passes the test condition. All added rules are tested against the node passed.