Skip to content

Commit

Permalink
ui: Fix undefined format and return unformatted number as string
Browse files Browse the repository at this point in the history
  • Loading branch information
metalmatze committed Dec 16, 2021
1 parent 9402dec commit fcabfe0
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 fcabfe0

Please sign in to comment.