diff options
author | Matt Godbolt <matt@godbolt.org> | 2017-12-21 07:49:41 -0600 |
---|---|---|
committer | Matt Godbolt <matt@godbolt.org> | 2017-12-21 08:11:32 -0600 |
commit | 10e8f72fcb44b4d68d207b5af927ed96530f3eb3 (patch) | |
tree | 7bde775a213e70f3881ab4a97b1d7cf6a3de8ed6 /lib/compile-handler.js | |
parent | 7e884d5110fe6adb8fb8fefbca26100a4d47d76e (diff) | |
download | compiler-explorer-10e8f72fcb44b4d68d207b5af927ed96530f3eb3.tar.gz compiler-explorer-10e8f72fcb44b4d68d207b5af927ed96530f3eb3.zip |
Remove filter(_.identity) in favour of _.compact()
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) { |