From c7b77a08d3fad0ba93605e69f21b939614c383e5 Mon Sep 17 00:00:00 2001 From: Sahil Date: Mon, 18 Nov 2019 18:23:24 +0530 Subject: [PATCH] fix: refactor redundant code this.groups.push(GroupInstance) was common to both if and else clause added one liner ternary operation instead of if else to set mode value. --- lib/webpack-cli.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/webpack-cli.js b/lib/webpack-cli.js index 743e1f73e58..b09c6fdf1a1 100644 --- a/lib/webpack-cli.js +++ b/lib/webpack-cli.js @@ -81,15 +81,9 @@ class WebpackCLI extends GroupHelper { } const GroupInstance = new GroupClass(value); if (key === 'basic') { - if (GroupInstance.opts.outputOptions.dev) { - mode = 'dev'; - } else { - mode = 'prod'; - } - this.groups.push(GroupInstance); - } else { - this.groups.push(GroupInstance); + mode = GroupInstance.opts.outputOptions.dev ? 'dev' : 'prod'; } + this.groups.push(GroupInstance); } }