charlike
Version:
Small, fast, simple and streaming project scaffolder for myself, but not only. Supports hundreds of template engines through the @JSTransformers API or if you want custom `render` function passed through options
13 lines (11 loc) • 441 B
JavaScript
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