estree-is-member-expression
check if an AST node is a MemberExpression, in general or a specific one
Install
npm install estree-is-member-expression
Usage
var isMemberExpression = require('estree-is-member-expression')
var node = parse('function a () {}')
isMemberExpression(node)
var node = parse('module.exports')
isMemberExpression(node)
isMemberExpression(node, 'module.exports')
isMemberExpression(node, 'module.filename')
isMemberExpression(node, 'module.filename.toString')
var node = parse('module.filename.toString')
isMemberExpression(node, 'module.filename.toString')
Also see the tests for more examples.
API
isMemberExpression(node, pattern)
Check if node
is a MemberExpression.
If pattern
is given, check if node
is a MemberExpression matching the pattern
.
pattern
can be a .-delimited string or an array. The pattern can contain more than two elements, all of them must match.
License
Apache-2.0