Commit 0df2c9e6cb30721628bae20985a8ecee3eab8c2e
1 parent
0ae74b77
Prevent unnecessarily converting strings to numbers
Showing
1 changed file
with
1 additions
and
1 deletions
@@ -146,7 +146,7 @@ function splitCSV(str: string, sep: string): string[] { | @@ -146,7 +146,7 @@ function splitCSV(str: string, sep: string): string[] { | ||
146 | 146 | ||
147 | function isNumeric(str: any): boolean { | 147 | function isNumeric(str: any): boolean { |
148 | str = str.replace(',', '.'); | 148 | str = str.replace(',', '.'); |
149 | - return !isNaN(parseFloat(str)) && isFinite(str); | 149 | + return (str - parseFloat(str) + 1) >= 0 && Number(str).toString() === str; |
150 | } | 150 | } |
151 | 151 | ||
152 | function convertStringToJSType(str: string): any { | 152 | function convertStringToJSType(str: string): any { |