From f43ef246c16796a79d6df67bea2f58b3ee4a3f46 Mon Sep 17 00:00:00 2001 From: Rubilmax Date: Mon, 17 Oct 2022 23:11:53 +0200 Subject: [PATCH] fix(format): fixed digits formatting --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 404bd3b..9eccd7a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -88,7 +88,7 @@ BigNumber.prototype.format = function (decimals?: number, digits?: number) { digits ??= decimals; return digits < decimals - ? formatted.slice(0, dotIndex + decimals - digits) + ? formatted.slice(0, dotIndex + 1 + digits) : formatted + "0".repeat(digits - decimals); }; BigNumber.prototype.toFloat = function (decimals?: number) {