Whether this is a breaking change or not is debatable so it has been released as a major version just in case.
Non-breaking change since v8.2.1
These changes affect the output only, there are no changes to the API or minimum supported Node version (still v12.17).
- Fixed an issue where precision and Intl formatting was not applied to small numbers. #15
- Removed minimumFractionDigits from unit number formatting. This removes superfluous precision, some examples:
byteSize(1000).toString()
now returns1 kB
instead of1.0 kB
, removing the superfluous one decimal place of precision.byteSize(1500000, { precision: 5 }).toString()
now returns1.5 MB
instead of1.50000 MB
, again removing superfluous precision.- However,
byteSize(1500010, { precision: 5 }).toString()
will return1.50001 MB
as there is meaningful, non-zero precision to display.