Skip to content

Commit

Permalink
chore: improve comment
Browse files Browse the repository at this point in the history
  • Loading branch information
VmMad committed May 13, 2024
1 parent 8cdd687 commit e7a2385
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions client/src/helpers/nova/formatAmountWithMetricUnit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit e7a2385

Please sign in to comment.