Skip to content

Commit

Permalink
use switch/case for argument detection
Browse files Browse the repository at this point in the history
  • Loading branch information
grische committed Jul 26, 2024
1 parent 0f50468 commit 68b6963
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions json-to-go-v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,13 @@ if (typeof module === 'undefined' || !module.parent) {
}

const argument = val.replace(/-/g, '')
if (argument === "big")
console.warn(`Warning: The argument '${argument}' has been deprecated and has no effect anymore`)
else {
console.error(`Unexpected argument ${val} received`)
process.exit(1)
switch (argument) {
case "big":
console.warn(`Warning: The argument '${argument}' has been deprecated and has no effect anymore`)
break
default:
console.error(`Unexpected argument ${val} received`)
process.exit(1)
}
})

Expand Down

0 comments on commit 68b6963

Please sign in to comment.