Skip to content

Commit 2796151

Browse files
committed
make more minor changes in Switches function (utility.ts)
1 parent 744d23e commit 2796151

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/utility.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,12 @@ export const Switches = function (switches: Record<string, any>) {
193193
switches = switches || {};
194194
let a = [];
195195
// Set default values of boolean switches
196-
switches.so = switches.so === true ? true : false;
197-
switches.spl = switches.spl === true ? true : false;
198-
switches.ssc = switches.ssc === false ? false : true;
199-
switches.ssw = switches.ssw === true ? true : false;
200-
switches.y = switches.y === false ? false : true;
196+
for (const key of ['so', 'spl', 'ssw']) {
197+
if (switches[key] !== true) switches[key] = false;
198+
}
199+
for (const key of ['ssc', 'y']) {
200+
if (switches[key] !== false) switches[key] = true;
201+
}
201202

202203
/*jshint forin:false*/
203204
for (const s in switches) {

0 commit comments

Comments
 (0)