diff --git a/src/hooks/useCryptoPrices.js b/src/hooks/useCryptoPrices.js index 66ef2fd..43f5f89 100644 --- a/src/hooks/useCryptoPrices.js +++ b/src/hooks/useCryptoPrices.js @@ -36,14 +36,14 @@ async function fetchPrices() { function toWei(usdTarget, tokenPriceUsd) { if (!tokenPriceUsd || tokenPriceUsd <= 0) return undefined; const raw = usdTarget / tokenPriceUsd; - if (!isFinite(raw) || isNaN(raw)) return undefined; + if (!isFinite(raw) || Number.isNaN(raw)) return undefined; try { return parseEther(raw.toFixed(8)); } catch { return undefined; } } function toHuman(usdTarget, tokenPriceUsd, decimals = 5) { if (!tokenPriceUsd || tokenPriceUsd <= 0) return undefined; const raw = usdTarget / tokenPriceUsd; - if (!isFinite(raw) || isNaN(raw)) return undefined; + if (!isFinite(raw) || Number.isNaN(raw)) return undefined; return raw.toFixed(decimals); } diff --git a/src/utils/formatters.js b/src/utils/formatters.js index 824f601..a24c97c 100644 --- a/src/utils/formatters.js +++ b/src/utils/formatters.js @@ -1,5 +1,5 @@ export const formatFileSize = (bytes) => { - if (typeof bytes !== 'number' || isNaN(bytes) || bytes <= 0) return '0 Bytes'; + if (typeof bytes !== 'number' || Number.isNaN(bytes) || bytes <= 0) return '0 Bytes'; const k = 1024; const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB']; const i = Math.floor(Math.log(bytes) / Math.log(k));