mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-15 18:26:15 +01:00
refactor: use loash when possible (#7230)
This commit is contained in:
committed by
Barış Soner Uşaklı
parent
a4ab13d323
commit
e1ca2d81f9
@@ -167,19 +167,14 @@ function build(targets, options, callback) {
|
||||
return aliases[target];
|
||||
})
|
||||
// filter nonexistent targets
|
||||
.filter(Boolean)
|
||||
// map multitargets to their sets
|
||||
.reduce(function (prev, target) {
|
||||
if (Array.isArray(targetHandlers[target])) {
|
||||
return prev.concat(targetHandlers[target]);
|
||||
}
|
||||
.filter(Boolean);
|
||||
|
||||
return prev.concat(target);
|
||||
}, [])
|
||||
// unique
|
||||
.filter(function (target, i, arr) {
|
||||
return arr.indexOf(target) === i;
|
||||
});
|
||||
// map multitargets to their sets
|
||||
targets = _.uniq(_.flatMap(targets, target => (
|
||||
Array.isArray(targetHandlers[target]) ?
|
||||
targetHandlers[target] :
|
||||
target
|
||||
)));
|
||||
|
||||
winston.verbose('[build] building the following targets: ' + targets.join(', '));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user