Use async v2

This commit is contained in:
Peter Jaszkowiak
2017-01-02 22:23:17 -07:00
parent cb82824c13
commit ec544518e8
9 changed files with 73 additions and 40 deletions

View File

@@ -161,9 +161,7 @@ var middleware;
});
// Filter out plugins with invalid paths
async.filter(paths, file.exists, function (paths) {
next(null, paths);
});
async.filter(paths, file.exists, next);
},
function (paths, next) {
async.map(paths, Plugins.loadPluginInfo, next);
@@ -346,7 +344,13 @@ var middleware;
async.filter(dirs, function (dir, callback) {
fs.stat(dir, function (err, stats) {
callback(!err && stats.isDirectory());
if (err) {
if (err.code === 'ENOENT') {
return callback(null, false);
}
return callback(err);
}
callback(null, stats.isDirectory());
});
}, function (plugins) {
next(null, plugins);