Repository navigation
Commit 4aed155
committed
Fix NaN handling in currency conversion input validation
The functions didn't validate that credits and amountInCents are finite numbers.
If they were NaN or Infinity, Math.ceil(NaN * centsPerCredit) would return NaN.
Added Number.isFinite() checks to return 0 for invalid inputs.1 parent 7b65652 commit 4aed155
1 file changed
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| 26 | + | |
| 27 | + | |
24 | 28 | | |
25 | 29 | | |
0 commit comments