Hey is a decentralized and permissionless social media app built with Lens Protocol 🌿

Refactor humanize helper function for improved readability and error handling

yoginth.com 0f70989c a6d30897

verified
+2 -7
+2 -7
apps/web/src/helpers/humanize.ts
··· 1 - const humanize = (number: number): string => { 2 - if (typeof number !== "number" || Number.isNaN(number)) { 3 - return ""; 4 - } 5 - 6 - return number.toLocaleString(); 7 - }; 1 + const humanize = (n: number): string => 2 + Number.isFinite(n) ? n.toLocaleString() : ""; 8 3 9 4 export default humanize;