Skip to content

Commit

Permalink
chore: cleanup syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
fmaclen committed Oct 24, 2023
1 parent 64fdabf commit 785cf39
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/CurrencyInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@
// If there is already a decimal point, don't allow more than one
const isPunctuationDuplicated = () => {
const isPressedKeyPunctuation = event.key === ',' || event.key === '.';
if (isDecimalComma) return isPressedKeyPunctuation && formattedValue.split(',').length >= 2;
if (!isDecimalComma) return isPressedKeyPunctuation && formattedValue.split('.').length >= 2;
if (!isPressedKeyPunctuation) return false;
if (isDecimalComma) return formattedValue.split(',').length >= 2;
if (!isDecimalComma) return formattedValue.split('.').length >= 2;
return false;
};
Expand Down

0 comments on commit 785cf39

Please sign in to comment.