ags
This commit is contained in:
parent
eddf7cecb8
commit
aea798d119
16631 changed files with 1480363 additions and 257 deletions
15
home/ags/node_modules/eslint-plugin-promise/rules/lib/is-inside-promise.js
generated
vendored
Normal file
15
home/ags/node_modules/eslint-plugin-promise/rules/lib/is-inside-promise.js
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
'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
|
||||
Loading…
Add table
Add a link
Reference in a new issue