Skip to content

Commit

Permalink
Fixes decimals not displaying properly
Browse files Browse the repository at this point in the history
Resolves #10
  • Loading branch information
Paultje52 committed Aug 2, 2023
1 parent 8764b79 commit 04c064c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ let formats = ["", "K", "M", "B", "T", ...result];
*/
function readables(number, decPlaces = 1, formatThousand = true) {
if (!formatThousand && number <= 999999) return number.toLocaleString("en");

if (number.toString().includes("e")) number = BigInt(number);

const splitted = number.toString().split("");
const splitted = number.toString().split(".")[0].split("");
if (splitted.length <= 3) return number.toString();
const result = Math.floor((splitted.length-1)/3);

Expand Down

0 comments on commit 04c064c

Please sign in to comment.