Skip to content

Commit

Permalink
fix: check if value compatible with Big.js
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov committed Aug 23, 2022
1 parent d8be24e commit 4617954
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/widget/src/utils/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ export const formatAmount = (
if (parsedAmount < 0) {
return Math.abs(parsedAmount).toString();
}
if (returnInitial) {
return amount;
try {
if (returnInitial && Big(amount)) {
return amount;
}
} catch {
return '';
}
return Big(parsedAmount).toString();
};
Expand Down

0 comments on commit 4617954

Please sign in to comment.