Skip to content

Commit

Permalink
Add curly brackets and redundant catch argument
Browse files Browse the repository at this point in the history
  • Loading branch information
hanneskuettner committed Apr 30, 2024
1 parent a583510 commit 078683a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export function maybeStringifyBigInt(value: number | bigint): string | number {
if (value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER) return String(value);
else return Number(value);
if (value > Number.MAX_SAFE_INTEGER || value < Number.MIN_SAFE_INTEGER) {
return String(value);
}

return Number(value);
}
2 changes: 1 addition & 1 deletion api/src/utils/parse-numeric-string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function parseNumericString(stringValue: string): NumericValue | null {
if (number > Number.MAX_SAFE_INTEGER || number < Number.MIN_SAFE_INTEGER) {
try {
number = BigInt(stringValue);
} catch (_) {
} catch {
// BigInt parsing failed, e.g. it was a float larger than MAX_SAFE_INTEGER
return null;
}
Expand Down

0 comments on commit 078683a

Please sign in to comment.