mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 16:35:47 +01:00
chore: eslint prefer-arrow-callback
This commit is contained in:
committed by
Julian Lam
parent
707b55b6a5
commit
b56d9e12b5
@@ -22,7 +22,7 @@ module.exports = function (theModule, ignoreKeys) {
|
||||
}
|
||||
|
||||
const keys = Object.keys(module);
|
||||
keys.forEach(function (key) {
|
||||
keys.forEach((key) => {
|
||||
if (ignoreKeys.includes(key)) {
|
||||
return;
|
||||
}
|
||||
@@ -40,9 +40,7 @@ module.exports = function (theModule, ignoreKeys) {
|
||||
return async function wrapperCallback(...args) {
|
||||
if (arguments.length && typeof arguments[arguments.length - 1] === 'function') {
|
||||
const cb = args.pop();
|
||||
args.push(function (err, res) {
|
||||
return res !== undefined ? cb(err, res) : cb(err);
|
||||
});
|
||||
args.push((err, res) => (res !== undefined ? cb(err, res) : cb(err)));
|
||||
return callbackFn.apply(null, args);
|
||||
}
|
||||
return origFn.apply(null, arguments);
|
||||
|
||||
Reference in New Issue
Block a user