estree-is-require
check if an AST node is a call to require()
Last updated 3 years ago by goto-bus-stop .
Apache-2.0 · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install estree-is-require 
SYNC missed versions from official npm registry.

estree-is-require

check if an AST node is a valid require() call

npm travis standard

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.

License

Apache-2.0

Current Tags

  • 1.0.0                                ...           latest (3 years ago)

1 Versions

  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 54
This Month 183
Last Day 1
Last Week 45
Last Month 264
Dependencies (1)
Dev Dependencies (3)

Copyright 2014 - 2017 © taobao.org |