Skip to content

Commit

Permalink
feat: add bigint type as value parameter
Browse files Browse the repository at this point in the history
bigint nowadays is commonly used
  • Loading branch information
frani authored Jul 5, 2024
1 parent 9ddc13b commit a80a850
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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;
}
Expand Down

0 comments on commit a80a850

Please sign in to comment.