Skip to content

Commit

Permalink
Bug fix: warning was shown when invoking jdenticon with command line …
Browse files Browse the repository at this point in the history
…options `-v`/`--version` or `-h`/`--help`.
  • Loading branch information
dmester committed Jul 30, 2020
1 parent 76aa0ca commit 5c62467
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions bin/jdenticon.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,16 @@ function parseArgs(args) {
var alias = aliases[aliasIndex];

if (arg === alias) {
var value = hasValue ? args[argIndex + 1] : true;
if (argIndex + 1 >= args.length) {
console.warn("WARN Missing value of argument " + alias);
var value;

if (hasValue) {
if (argIndex + 1 < args.length) {
value = args[argIndex + 1];
} else {
console.warn("WARN Missing value of argument " + alias);
}
} else {
value = true;
}

args.splice(argIndex, hasValue ? 2 : 1);
Expand Down

0 comments on commit 5c62467

Please sign in to comment.