Fixed rounding errors in GitHub stars

This commit is contained in:
squidfunk
2020-04-13 16:12:26 +02:00
parent 24f0c45dce
commit a96fa1c3aa
7 changed files with 8 additions and 8 deletions

View File

@@ -115,7 +115,7 @@ export function truncate(value: string, n: number): string {
export function round(value: number): string {
if (value > 999) {
const digits = +((value - 950) % 1000 > 99)
return `${((value + 1) / 1000).toFixed(digits)}k`
return `${((value + 0.000001) / 1000).toFixed(digits)}k`
} else {
return value.toString()
}