Skip to content

Commit

Permalink
fix: Regexp-related bug in Safari (#530)
Browse files Browse the repository at this point in the history
  • Loading branch information
valiafetisov authored Nov 10, 2022
1 parent cbf5727 commit ba4c763
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/helpers/formatToAutomaticDecimalPoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ function limitedValue(value: number | BigNumber): number | BigNumber {
return value;
}

// We choose regex over native JS solutions, as using native solutions only support numbers
export function formatWithThousandSeparators(value: string): string {
return value.replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ',');
// We choose regex over native JS solutions, as using native solutions only support numbers
return value.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, '$1,');
}

interface formatToAutomaticDecimalPointsOptions {
Expand Down

0 comments on commit ba4c763

Please sign in to comment.