Skip to content

Commit

Permalink
chore: lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jun 18, 2023
1 parent 0d0d2ec commit 5e56aa9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export function toArray(val: any) {
if (Array.isArray(val)) {
return val;
}
return val !== undefined ? [val] : [];
return val === undefined ? [] : [val];
}

export function formatLineColumns(lines: string[][], linePrefix = "") {
Expand Down
6 changes: 3 additions & 3 deletions src/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ export function parseArgs<T extends ArgsDef = ArgsDef>(
const nextPositionalArgument = positionalArguments.shift();
if (nextPositionalArgument !== undefined) {
parsedArgsProxy[arg.name] = nextPositionalArgument;
} else if (arg.default !== undefined) {
parsedArgsProxy[arg.name] = arg.default;
} else {
} else if (arg.default === undefined) {
throw new CLIError(
`Missing required positional argument: ${arg.name.toUpperCase()}`,
"EARG"
);
} else {
parsedArgsProxy[arg.name] = arg.default;
}
} else if (arg.required && parsedArgsProxy[arg.name] === undefined) {
throw new CLIError(`Missing required argument: --${arg.name}`, "EARG");
Expand Down

0 comments on commit 5e56aa9

Please sign in to comment.