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
|
|
|
|
})
|
|
|
|
}
|