is-callback.js 428 B

1234567891011121314
  1. 'use strict'
  2. const isNamedCallback = require('./is-named-callback')
  3. function isCallback(node, exceptions) {
  4. const isCallExpression = node.type === 'CallExpression'
  5. // istanbul ignore next -- always invoked on `CallExpression`
  6. const callee = node.callee || {}
  7. const nameIsCallback = isNamedCallback(callee.name, exceptions)
  8. const isCB = isCallExpression && nameIsCallback
  9. return isCB
  10. }
  11. module.exports = isCallback