From e7a2385a3b161ef7d4973b8576a70bd888e1624e Mon Sep 17 00:00:00 2001 From: JCNoguera Date: Mon, 13 May 2024 12:30:56 +0200 Subject: [PATCH] chore: improve comment --- client/src/helpers/nova/formatAmountWithMetricUnit.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/helpers/nova/formatAmountWithMetricUnit.ts b/client/src/helpers/nova/formatAmountWithMetricUnit.ts index 3b318a389..e00793cd3 100644 --- a/client/src/helpers/nova/formatAmountWithMetricUnit.ts +++ b/client/src/helpers/nova/formatAmountWithMetricUnit.ts @@ -16,12 +16,12 @@ export function formatAmountWithMetricUnit(value: number | bigint | string, toke const formattedValue = UnitsHelper.formatBest(amount, 0); - // remove leading lowercase "i" from formatted value - const lastIIndex = formattedValue.lastIndexOf("i"); - if (lastIIndex === -1) return `${formattedValue} ${tokenInfo.unit}`; + // Remove iota unit if it exists + const lastIotaIndex = formattedValue.lastIndexOf("i"); + if (lastIotaIndex === -1) return `${formattedValue} ${tokenInfo.unit}`; const formattedAmountWithToken = - formattedValue.substring(0, lastIIndex) + formattedValue.substring(lastIIndex + 1) + `${tokenInfo.unit}`; + formattedValue.substring(0, lastIotaIndex) + formattedValue.substring(lastIotaIndex + 1) + `${tokenInfo.unit}`; return formattedAmountWithToken; }