You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
470 B
15 lines
470 B
'use strict' |
|
|
|
function isInsidePromise(node) { |
|
const isFunctionExpression = |
|
node.type === 'FunctionExpression' || |
|
node.type === 'ArrowFunctionExpression' |
|
const parent = node.parent || {} |
|
const callee = parent.callee || {} |
|
const name = (callee.property && callee.property.name) || '' |
|
const parentIsPromise = name === 'then' || name === 'catch' |
|
const isInCB = isFunctionExpression && parentIsPromise |
|
return isInCB |
|
} |
|
|
|
module.exports = isInsidePromise
|
|
|