2
0
mirror of https://github.com/tenrok/maska.git synced 2026-06-08 17:22:27 +03:00

fix: correct check for NaN #228

This commit is contained in:
Alexander Shabunevich
2024-08-26 21:22:47 +03:00
parent f5ec443c76
commit 1a885ce41d
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ export const processNumber = (value: string, masked = true, opts: MaskOptions):
const decimal = parts.find((part) => part.type === 'decimal')?.value ?? '.'
const float = prepare(value, group, decimal)
if (float === '' || Number.isNaN(float)) return sign
if (Number.isNaN(parseFloat(float))) return sign
// allow zero at the end
const floatParts = float.split('.')