When I read the source code, I found that the author will use return where there is no need to use return.
exports.getPort = function (options, callback) {
// code...
return _async.eachSeries(exports._defaultHosts, function(host, next) {
// code ...
return next();
}
}
What is the purpose or need of this usage?
next is likely a promise. Maybe in your code it is not used (no then / catch), but there might (and should) be some.
In case the promise was not returned then there is no way to catch errors or make sequentials asynchronous calls.