is-static-require.js 365 B

123456789101112131415
  1. 'use strict';
  2. const isStaticRequire = node => Boolean(
  3. node
  4. && node.type === 'CallExpression'
  5. && node.callee
  6. && node.callee.type === 'Identifier'
  7. && node.callee.name === 'require'
  8. && !node.optional
  9. && node.arguments.length === 1
  10. && node.arguments[0].type === 'Literal'
  11. && typeof node.arguments[0].value === 'string',
  12. );
  13. module.exports = isStaticRequire;