tools/number/parser: return 0 if value undefined
This commit is contained in:
parent
46d63e490c
commit
06ba8566b7
@ -1,6 +1,8 @@
|
||||
/* eslint-disable implicit-arrow-linebreak */
|
||||
export function parser(value?: string) {
|
||||
const normalized = (value || '0').replace(/\s/g, '').replaceAll(',', '.');
|
||||
if (!value) return 0;
|
||||
|
||||
const normalized = value.replace(/\s/g, '').replaceAll(',', '.');
|
||||
|
||||
return Number.parseFloat(normalized);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user