mapcomplete/Utils.ts

17 lines
347 B
TypeScript
Raw Normal View History

2020-07-23 23:12:57 +00:00
export class Utils {
/**
* Gives a clean float, or undefined if parsing fails
* @param str
*/
static asFloat(str): number {
if (str) {
const i = parseFloat(str);
if (isNaN(i)) {
return undefined;
}
return i;
}
return undefined;
}
}