From a80a85032f69633b511aa7e4960d46d44864dd7f Mon Sep 17 00:00:00 2001 From: frani Date: Fri, 5 Jul 2024 17:46:12 -0300 Subject: [PATCH] feat: add bigint type as value parameter bigint nowadays is commonly used --- index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 6f2d0f8..df19bec 100644 --- a/index.js +++ b/index.js @@ -39,7 +39,7 @@ var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i; /** * Convert the given value in bytes into a string or parse to string to an integer in bytes. * - * @param {string|number} value + * @param {string|number|bigint} value * @param {{ * case: [string], * decimalPlaces: [number] @@ -59,6 +59,10 @@ function bytes(value, options) { if (typeof value === 'number') { return format(value, options); } + + if (typeof value === 'bigint') { + return format(Number(value), options); + } return null; }