1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/eslint-plugin-promise/rules/lib/has-promise-callback.js

17 lines
451 B
JavaScript
Raw Permalink Normal View History

2023-12-18 13:12:25 +08:00
/**
2024-01-16 21:26:16 +08:00
* Library: Has Promise Callback
2023-12-18 13:12:25 +08:00
* Makes sure that an Expression node is part of a promise
* with callback functions (like then() or catch())
*/
'use strict'
function hasPromiseCallback(node) {
if (node.type !== 'CallExpression') return
if (node.callee.type !== 'MemberExpression') return
const propertyName = node.callee.property.name
return propertyName === 'then' || propertyName === 'catch'
}
module.exports = hasPromiseCallback