Package Exports
- estree-is-require
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 (estree-is-require) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
estree-is-require
check if an AST node is a valid require()
call
Install
npm install estree-is-require
Usage
var isRequire = require('estree-is-require')
var node = parse('function a () {}')
isRequire(node) // false
var node = parse('require("abc")')
isRequire(node) // true
isRequire(node, 'abc') // true
isRequire(node, 'xyz') // false
var node = parse('require(10)')
isRequire(node, 10) // true
Also see the tests for more examples.
API
isRequire(node, source)
Check if node
is a call to require
.
If source
is given, the first argument to require
matches it.