Gauge/BarGauge: Support decimals for min/max toFloatOrUndefined (#18368)

This commit is contained in:
Ryan McKinley
2019-08-03 07:10:41 -07:00
committed by Torkel Ödegaard
parent 202c136238
commit 09e7938499
2 changed files with 13 additions and 5 deletions

View File

@@ -55,3 +55,11 @@ export function toIntegerOrUndefined(value: string): number | undefined {
const v = parseInt(value, 10);
return isNaN(v) ? undefined : v;
}
export function toFloatOrUndefined(value: string): number | undefined {
if (!value) {
return undefined;
}
const v = parseFloat(value);
return isNaN(v) ? undefined : v;
}