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
390 B
15 lines
390 B
5 years ago
|
'use strict'
|
||
|
|
||
|
let callbacks = ['done', 'cb', 'callback', 'next']
|
||
|
|
||
|
module.exports = function isNamedCallback(potentialCallbackName, exceptions) {
|
||
|
for (let i = 0; i < exceptions.length; i++) {
|
||
|
callbacks = callbacks.filter(item => {
|
||
|
return item !== exceptions[i]
|
||
|
})
|
||
|
}
|
||
|
return callbacks.some(trueCallbackName => {
|
||
|
return potentialCallbackName === trueCallbackName
|
||
|
})
|
||
|
}
|