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

15 lines
394 B
JavaScript
Raw Normal View History

2023-12-18 13:12:25 +08:00
'use strict'
let callbacks = ['done', 'cb', 'callback', 'next']
module.exports = function isNamedCallback(potentialCallbackName, exceptions) {
for (let i = 0; i < exceptions.length; i++) {
2024-01-16 21:26:16 +08:00
callbacks = callbacks.filter((item) => {
2023-12-18 13:12:25 +08:00
return item !== exceptions[i]
})
}
2024-01-16 21:26:16 +08:00
return callbacks.some((trueCallbackName) => {
2023-12-18 13:12:25 +08:00
return potentialCallbackName === trueCallbackName
})
}