Fix iOS 12 crashing in scroller

This commit is contained in:
Bill Thornton
2024-01-03 10:03:15 -05:00
parent b6745dcfbb
commit 7607c8dbd3
3 changed files with 49 additions and 15 deletions
+6 -5
View File
@@ -19,9 +19,10 @@ export function toBoolean(value: string | undefined | null, defaultValue = false
* @returns {number} The value.
*/
export function toFloat(value: string | null | undefined, defaultValue = 0) {
if (!value || isNaN(value as never)) {
return defaultValue;
} else {
return parseFloat(value);
}
if (!value) return defaultValue;
const number = parseFloat(value);
if (isNaN(number)) return defaultValue;
return number;
}