blob: 6f08e2081a1394be7d53b2f75d4b4518708b978a [file] [log] [blame]
function isInsidePromise (node) {
var isFunctionExpression = node.type === 'FunctionExpression' ||
node.type === 'ArrowFunctionExpression'
var parent = node.parent || {}
var callee = parent.callee || {}
var name = callee.property && callee.property.name || ''
var parentIsPromise = name === 'then' || name === 'catch'
var isInCB = isFunctionExpression && parentIsPromise
return isInCB
}
module.exports = isInsidePromise