JSPM

estree-is-require

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12165
  • Score
    100M100P100Q138231F
  • License Apache-2.0

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

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

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