Skip to content

Commit

Permalink
Renamed valueOrNan to rawUserInputOrEmpty for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
amitx13 committed Jul 22, 2024
1 parent 0915ac5 commit 247baef
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/BitcoinAmountInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ const BitcoinAmountInput = forwardRef(
field.onBlur(e)
}}
onChange={(e) => {
const valueOrNan = e.target.value ?? ''
const floatValueOrNan = parseFloat(valueOrNan)
const rawUserInputOrEmpty = e.target.value ?? ''
const floatValueOrNan = parseFloat(rawUserInputOrEmpty)
if (!isValidNumber(floatValueOrNan)) {
form.setFieldValue(
field.name,
Expand All @@ -132,8 +132,8 @@ const BitcoinAmountInput = forwardRef(
const value: number = floatValueOrNan
let numberValues: string | undefined
const unit =
valueOrNan.includes('.') && parseFloat(valueOrNan)
? unitFromValue(String(valueOrNan))
rawUserInputOrEmpty.includes('.') && parseFloat(rawUserInputOrEmpty)
? unitFromValue(String(rawUserInputOrEmpty))
: unitFromValue(String(value))
if (unit === 'BTC') {
const splitted = String(value).split('.')
Expand Down

0 comments on commit 247baef

Please sign in to comment.