format.number.ts 282 Bytes Raw Blame History Permalink 1 2 3 4 5 6 7 8 9 10 export const formatNumber = (number : number) : string => { if(`${number}`.length > 6) { return `${Math.floor(number / 1000000)}m` } else if(`${number}`.length > 3) { return `${Math.floor(number / 1000)}k` } else { return `${number}`; } }