diff --git a/web/cashtab/src/components/Authentication/ProtectableComponentWrapper.js b/web/cashtab/src/components/Authentication/ProtectableComponentWrapper.js --- a/web/cashtab/src/components/Authentication/ProtectableComponentWrapper.js +++ b/web/cashtab/src/components/Authentication/ProtectableComponentWrapper.js @@ -15,7 +15,7 @@ } // prompt if user would like to enable biometric lock when the app first run - if (isAuthenticationRequired === undefined) { + if (typeof isAuthenticationRequired === 'undefined') { return ; } diff --git a/web/cashtab/src/components/Configure/Configure.js b/web/cashtab/src/components/Configure/Configure.js --- a/web/cashtab/src/components/Configure/Configure.js +++ b/web/cashtab/src/components/Configure/Configure.js @@ -643,7 +643,7 @@ // in the edge case of a fresh new wallet on a fresh new browser, remove the initialization entry to avoid an undefined contact in array if ( tempContactListArray && - tempContactListArray[0].address === undefined + typeof tempContactListArray[0].address === 'undefined' ) { tempContactListArray.shift(); } @@ -694,7 +694,7 @@ // in the edge case of a fresh new wallet on a fresh new browser, remove the initialization entry to avoid an undefined contact in array if ( loadContactListStatus && - loadContactListStatus[0].address === undefined + typeof loadContactListStatus[0].address === 'undefined' ) { loadContactListStatus.shift(); } @@ -793,7 +793,7 @@ if (renameSuccess) { Modal.success({ content: `Wallet "${ - oldActiveWalletName !== undefined + typeof oldActiveWalletName !== 'undefined' ? oldActiveWalletName : walletToBeRenamed.name }" renamed to "${newWalletName}"`, diff --git a/web/cashtab/src/hooks/useWebAuthentication.js b/web/cashtab/src/hooks/useWebAuthentication.js --- a/web/cashtab/src/hooks/useWebAuthentication.js +++ b/web/cashtab/src/hooks/useWebAuthentication.js @@ -94,7 +94,7 @@ // save the config whenever it is changed useEffect(async () => { - if (isAuthenticationRequired === undefined) return; + if (typeof isAuthenticationRequired === 'undefined') return; await saveAuthenticationConfigToLocalStorage(); }, [isAuthenticationRequired, credentialId]); diff --git a/web/cashtab/src/utils/formatting.js b/web/cashtab/src/utils/formatting.js --- a/web/cashtab/src/utils/formatting.js +++ b/web/cashtab/src/utils/formatting.js @@ -21,7 +21,7 @@ if (fiatBalance === 0) { return Number(fiatBalance).toFixed(currency.cashDecimals); } - if (optionalLocale === undefined) { + if (typeof optionalLocale === 'undefined') { return fiatBalance.toLocaleString({ maximumFractionDigits: currency.cashDecimals, }); @@ -36,10 +36,10 @@ export const formatSavedBalance = (swBalance, optionalLocale) => { try { - if (swBalance === undefined) { + if (typeof swBalance === 'undefined') { return 'N/A'; } else { - if (optionalLocale === undefined) { + if (typeof optionalLocale === 'undefined') { return new Number(swBalance).toLocaleString({ maximumFractionDigits: currency.cashDecimals, }); @@ -56,7 +56,7 @@ export const formatBalance = (unformattedBalance, optionalLocale) => { try { - if (optionalLocale === undefined) { + if (typeof optionalLocale === 'undefined') { return new Number(unformattedBalance).toLocaleString({ maximumFractionDigits: currency.cashDecimals, }); @@ -82,8 +82,8 @@ let locale = defaultLocale; try { if ( - tokenDecimal === undefined || - unformattedBalance === undefined || + typeof tokenDecimal === 'undefined' || + typeof unformattedBalance === 'undefined' || typeof tokenDecimal !== 'number' || !BigNumber.isBigNumber(unformattedBalance) ) {