Skip to content

Commit 5e56aa9

Browse files
committed
chore: lint code
1 parent 0d0d2ec commit 5e56aa9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/_utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export function toArray(val: any) {
44
if (Array.isArray(val)) {
55
return val;
66
}
7-
return val !== undefined ? [val] : [];
7+
return val === undefined ? [] : [val];
88
}
99

1010
export function formatLineColumns(lines: string[][], linePrefix = "") {

src/args.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ export function parseArgs<T extends ArgsDef = ArgsDef>(
4848
const nextPositionalArgument = positionalArguments.shift();
4949
if (nextPositionalArgument !== undefined) {
5050
parsedArgsProxy[arg.name] = nextPositionalArgument;
51-
} else if (arg.default !== undefined) {
52-
parsedArgsProxy[arg.name] = arg.default;
53-
} else {
51+
} else if (arg.default === undefined) {
5452
throw new CLIError(
5553
`Missing required positional argument: ${arg.name.toUpperCase()}`,
5654
"EARG"
5755
);
56+
} else {
57+
parsedArgsProxy[arg.name] = arg.default;
5858
}
5959
} else if (arg.required && parsedArgsProxy[arg.name] === undefined) {
6060
throw new CLIError(`Missing required argument: --${arg.name}`, "EARG");

0 commit comments

Comments
 (0)