From 622362c90f796f6f5618ab269b48b75dd05b8e83 Mon Sep 17 00:00:00 2001 From: HorizonCode Date: Fri, 27 Jun 2025 08:59:05 +0200 Subject: [PATCH] feat: add numberHumanReadable function for formatting numbers --- src/lib/utils.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib/utils.ts b/src/lib/utils.ts index eb6a47f..b0c4bb8 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -14,6 +14,10 @@ export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); } +export const numberHumanReadable = (number: number) => { + return number.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.'); +}; + export const playAudio = (path: string, volume: number) => { const audio = new Audio(path); audio.volume = volume;