Eliminate Useless Callback Wrappers in JavaScript
September 03, 2015
Just a quick tip from some code I encountered today. Instead of this:
function outerFunc (callback) {
doSomething(42, function (err) {
callback(err)
})
}
Eliminate the useless callback wrapper function:
function outerFunc (callback) {
doSomething(42, callback)
}
It's more concise and more efficient and entirely equivalent.