Skip to content

Commit

Permalink
change parser validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklas Lennerdahl committed Nov 1, 2023
1 parent de6047f commit 85c2af5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/parser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const parseToNumberOrUndefined = (input: string): number | undefined => {
return input !== null && input !== undefined && !isNaN(Number(input)) ? parseInt(input) : undefined;
const number: number = Number(input);
return input === null || input === undefined || input === ' ' || isNaN(number) ? undefined : parseInt(input);
}

0 comments on commit 85c2af5

Please sign in to comment.