Skip to content

Commit

Permalink
Improving readablity of parameter conversion code.
Browse files Browse the repository at this point in the history
  • Loading branch information
BernardIgiri committed Sep 27, 2018
1 parent 0692340 commit a36ad15
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ if (process.argv.length < 3 ||
console.log("run with: usng-cli [function] [params]")
} else {
const conversionArgs = process.argv.slice(3).map(arg => {
if (arg === "true" || arg === "false") {
return arg === "true"
const argAsBool = arg.toLowerCase() === "true"
if (arg.match(/^true|false$/i)) {
return argAsBool
}
try {
const argAsJSON = JSON.parse(arg)
Expand Down

0 comments on commit a36ad15

Please sign in to comment.