Skip to content

Commit

Permalink
Merge pull request #500 from parca-dev/ui-fix-format-undefined
Browse files Browse the repository at this point in the history
ui: Fix undefined format and return unformatted number as string
  • Loading branch information
metalmatze committed Dec 16, 2021
2 parents 9402dec + fcabfe0 commit 6dae1ef
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ui/packages/shared/functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export const valueFormatter = (num: number, unit: string, digits: number): strin
const absoluteNum = Math.abs(num)
const format = knownValueFormatters[unit]

if (format === undefined || format === null) {
return num.toString()
}

const rx = /\.0+$|(\.[0-9]*[1-9])0+$/
let i
for (i = format.length - 1; i > 0; i--) {
Expand Down

0 comments on commit 6dae1ef

Please sign in to comment.