Skip to content

fix(amount): reject malformed numeric strings - #43

Open
huklaa wants to merge 1 commit into
circlefin:masterfrom
huklaa:fix-38-parse-amount-validation
Open

fix(amount): reject malformed numeric strings#43
huklaa wants to merge 1 commit into
circlefin:masterfrom
huklaa:fix-38-parse-amount-validation

Conversation

@huklaa

@huklaa huklaa commented Aug 21, 2026

Copy link
Copy Markdown

Fixes #38
parseAmount previously relied on parseFloat, which accepts valid numeric prefixes and silently ignores malformed trailing characters such as 10abc or 1.25xyz.
This change validates the entire normalized amount string before conversion, while preserving the existing normalization for supported currency symbols, commas, whitespace, parentheses, and Unicode minus characters.
It also uses Number.isFinite to reject non-finite values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: parseAmount accepts malformed amount strings with trailing characters

1 participant