Skip to content

Commit

Permalink
bin: refactor citgm-all
Browse files Browse the repository at this point in the history
Replace lodash _reduce() with Array.prototype.map().

Remove unused argument to launch().
  • Loading branch information
Trott authored and MylesBorins committed Feb 20, 2019
1 parent 0288616 commit 6e14df6
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions bin/citgm-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

const os = require('os');

const _ = require('lodash');
const async = require('async');

const checkTags = require('../lib/check-tags');
Expand Down Expand Up @@ -113,10 +112,10 @@ if (!citgm.windows) {
uidnumber(uid, gid, (err, uid, gid) => {
options.uid = uid;
options.gid = gid;
launch(options);
launch();
});
} else {
launch(options);
launch();
}

const modules = [];
Expand Down Expand Up @@ -194,16 +193,12 @@ function runTask(task, next) {
runCitgm(task.mod, task.name, next);
}

function filterLookup(result, value, key) {
result.push({
name: key,
mod: value
});
return result;
function mapCallback(name) {
return { name: name, mod: lookup[name] };
}

function launch() {
const collection = _.reduce(lookup, filterLookup, []);
const collection = Object.keys(lookup).map(mapCallback);

const q = async.queue(runTask, app.parallel || 1);
q.push(collection);
Expand Down

0 comments on commit 6e14df6

Please sign in to comment.