Constnium/node_modules/eslint-plugin-promise/rules/lib/is-callback.js

15 lines
428 B
JavaScript
Raw Normal View History

2022-06-23 02:27:43 +02:00
'use strict'
const isNamedCallback = require('./is-named-callback')
function isCallback(node, exceptions) {
const isCallExpression = node.type === 'CallExpression'
// istanbul ignore next -- always invoked on `CallExpression`
const callee = node.callee || {}
const nameIsCallback = isNamedCallback(callee.name, exceptions)
const isCB = isCallExpression && nameIsCallback
return isCB
}
module.exports = isCallback