bytes-formatter 21.6.18 → 21.6.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +2 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -36,8 +36,8 @@ export const formatBytes = (bytes) => {
36
36
  ++i;
37
37
  }
38
38
 
39
- // Use 1 decimal for values >= 1, 2 decimals for values < 1.
40
- const decimals = i > 0 ? (bytes >= 1 ? 1 : 2) : 0;
39
+ // Use 1 decimal for all units except bytes.
40
+ const decimals = i > 0 ? 1 : 0;
41
41
 
42
42
  return (decimals ? bytes.toFixed(decimals) : bytes) + " " + FORMATS[i];
43
43
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bytes-formatter",
3
3
  "type": "module",
4
- "version": "21.6.18",
4
+ "version": "21.6.19",
5
5
  "description": "Bytes formatter module provides a function to format byte values into human-readable strings with appropriate units (bytes, KB, MB, GB, TB, PB).",
6
6
  "homepage": "https://vpodk.com/bytes-formatter/",
7
7
  "repository": {