-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: format currency to number (#250)
* fix: format currency to number * feat: created tests to currency to number Co-authored-by: Michael Amaral <[email protected]>
- Loading branch information
1 parent
e1dc82c
commit d40c62b
Showing
2 changed files
with
9 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export const currencyToNumber = (currency: string): number => | ||
parseFloat(currency.replace('R$', '').replace('.', '').replace(',', '.')); | ||
parseFloat(currency.replace('R$', '').replace(/\./g, '').replace(/,/g, '.')) |