diff options
Diffstat (limited to 'lib/compile-handler.js')
-rw-r--r-- | lib/compile-handler.js | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/lib/compile-handler.js b/lib/compile-handler.js index d2094c3bb..1cbde43f4 100644 --- a/lib/compile-handler.js +++ b/lib/compile-handler.js @@ -96,19 +96,12 @@ function CompileHandler(gccProps, compilerProps) { this.setCompilers = function (compilers) { return Promise.all(_.map(compilers, this.create, this)) - .then(function (compilers) { - return _.filter(compilers, _.identity); + .then(_.compact) + .then(compilers => { + _.each(compilers, compiler => this.compilersById[compiler.compiler.id] = compiler); + return _.map(compilers, compiler => compiler.getInfo()); }) - .then(_.bind(function (compilers) { - _.each(compilers, function (compiler) { - this.compilersById[compiler.compiler.id] = compiler; - }, this); - return _.map(compilers, function (compiler) { - return compiler.getInfo(); - }); - }, this)).catch(function (err) { - logger.error(err); - }); + .catch(err => logger.error(err)); }; var proxy = httpProxy.createProxyServer({}); var textBanner = compilerProps('textBanner'); @@ -161,11 +154,8 @@ function CompileHandler(gccProps, compilerProps) { return next(new Error("Bad request")); } options = _.chain(quote.parse(options || '') - .map(function (x) { - if (typeof(x) === "string") return x; - return x.pattern; - })) - .filter(_.identity) + .map(x => typeof(x) === "string" ? x : x.pattern)) + .compact() .value(); function textify(array) { |