From 785cf39eff6075b6c1a37592f072bc1b3e75b568 Mon Sep 17 00:00:00 2001 From: Fernando Maclen Date: Tue, 24 Oct 2023 10:28:10 -0700 Subject: [PATCH] chore: cleanup syntax --- src/lib/CurrencyInput.svelte | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/CurrencyInput.svelte b/src/lib/CurrencyInput.svelte index 14e9c1e..519adb1 100644 --- a/src/lib/CurrencyInput.svelte +++ b/src/lib/CurrencyInput.svelte @@ -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; };