Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,24 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [11.0.31](https://github.com/avoidwork/filesize.js/compare/11.0.30...11.0.31)

- fix: apply precision before round for decimal units [`#404`](https://github.com/avoidwork/filesize.js/pull/404)
- chore(deps-dev): bump oxfmt from 0.76.0 to 0.77.0 [`#407`](https://github.com/avoidwork/filesize.js/pull/407)
- chore(deps-dev): bump rollup from 4.67.5 to 4.68.0 [`#406`](https://github.com/avoidwork/filesize.js/pull/406)
- chore(deps-dev): bump oxlint from 1.91.0 to 1.92.0 [`#405`](https://github.com/avoidwork/filesize.js/pull/405)
- chore(deps-dev): bump rollup from 4.67.4 to 4.67.5 [`#402`](https://github.com/avoidwork/filesize.js/pull/402)
- chore(deps-dev): bump oxlint from 1.90.0 to 1.91.0 [`#401`](https://github.com/avoidwork/filesize.js/pull/401)
- chore(deps-dev): bump oxfmt from 0.75.0 to 0.76.0 [`#400`](https://github.com/avoidwork/filesize.js/pull/400)
- chore(deps-dev): bump rollup from 4.67.3 to 4.67.4 [`#398`](https://github.com/avoidwork/filesize.js/pull/398)
- chore(deps-dev): bump rollup from 4.67.2 to 4.67.3 [`#397`](https://github.com/avoidwork/filesize.js/pull/397)
- fix: apply precision before round for decimal units (#404) [`#399`](https://github.com/avoidwork/filesize.js/issues/399)

#### [11.0.30](https://github.com/avoidwork/filesize.js/compare/11.0.29...11.0.30)

> 3 November 2026

- chore: release v11.0.30 [`#396`](https://github.com/avoidwork/filesize.js/pull/396)
- fix: reject invalid rounding methods [`#395`](https://github.com/avoidwork/filesize.js/pull/395)
- chore(deps-dev): bump rollup from 4.66.0 to 4.67.2 [`#394`](https://github.com/avoidwork/filesize.js/pull/394)
- chore(deps-dev): bump oxfmt from 0.74.0 to 0.75.0 [`#393`](https://github.com/avoidwork/filesize.js/pull/393)
Expand Down
15 changes: 12 additions & 3 deletions dist/filesize.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* @copyright 2026 Jason Mulligan <jason.mulligan@avoidwork.com>
* @license BSD-3-Clause
* @version 11.0.30
* @version 11.0.31
*/
'use strict';

Expand Down Expand Up @@ -858,8 +858,17 @@ function filesize(
val = valueResult.result;
e = valueResult.e;

// Rounding + auto-increment ceiling
const rounded = applyRounding(val, ceil, e, round, roundingFunc, autoExponent);
// Rounding + auto-increment ceiling.
// `precision` takes precedence over `round` for decimal units (e > 0): the
// significant-digit pass below must see the un-rounded scaled value, or a
// boundary value is rounded twice (999.499 kB -> 999.5 -> "1.00e+3" -> a
// premature unit bump) and digits beyond `round` never survive to
// toPrecision(). Whole bytes (e === 0) still round to integers — a byte
// count is an integer quantity, and the sub-1-byte outputs are pinned on it.
const precisionFirst = precisionAdjusted > 0 && e > 0;
const rounded = precisionFirst
? { value: val, e }
: applyRounding(val, ceil, e, round, roundingFunc, autoExponent);
result[0] = rounded.value;
e = rounded.e;

Expand Down
15 changes: 12 additions & 3 deletions dist/filesize.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* @copyright 2026 Jason Mulligan <jason.mulligan@avoidwork.com>
* @license BSD-3-Clause
* @version 11.0.30
* @version 11.0.31
*/
// Error Messages
const INVALID_NUMBER = "Invalid number";
Expand Down Expand Up @@ -852,8 +852,17 @@ function filesize(
val = valueResult.result;
e = valueResult.e;

// Rounding + auto-increment ceiling
const rounded = applyRounding(val, ceil, e, round, roundingFunc, autoExponent);
// Rounding + auto-increment ceiling.
// `precision` takes precedence over `round` for decimal units (e > 0): the
// significant-digit pass below must see the un-rounded scaled value, or a
// boundary value is rounded twice (999.499 kB -> 999.5 -> "1.00e+3" -> a
// premature unit bump) and digits beyond `round` never survive to
// toPrecision(). Whole bytes (e === 0) still round to integers — a byte
// count is an integer quantity, and the sub-1-byte outputs are pinned on it.
const precisionFirst = precisionAdjusted > 0 && e > 0;
const rounded = precisionFirst
? { value: val, e }
: applyRounding(val, ceil, e, round, roundingFunc, autoExponent);
result[0] = rounded.value;
e = rounded.e;

Expand Down
4 changes: 2 additions & 2 deletions dist/filesize.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/filesize.min.js.map

Large diffs are not rendered by default.

15 changes: 12 additions & 3 deletions dist/filesize.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* @copyright 2026 Jason Mulligan <jason.mulligan@avoidwork.com>
* @license BSD-3-Clause
* @version 11.0.30
* @version 11.0.31
*/
(function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports):typeof define==='function'&&define.amd?define(['exports'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f(g.filesize={}));})(this,(function(exports){'use strict';// Error Messages
const INVALID_NUMBER = "Invalid number";
Expand Down Expand Up @@ -852,8 +852,17 @@ function filesize(
val = valueResult.result;
e = valueResult.e;

// Rounding + auto-increment ceiling
const rounded = applyRounding(val, ceil, e, round, roundingFunc, autoExponent);
// Rounding + auto-increment ceiling.
// `precision` takes precedence over `round` for decimal units (e > 0): the
// significant-digit pass below must see the un-rounded scaled value, or a
// boundary value is rounded twice (999.499 kB -> 999.5 -> "1.00e+3" -> a
// premature unit bump) and digits beyond `round` never survive to
// toPrecision(). Whole bytes (e === 0) still round to integers — a byte
// count is an integer quantity, and the sub-1-byte outputs are pinned on it.
const precisionFirst = precisionAdjusted > 0 && e > 0;
const rounded = precisionFirst
? { value: val, e }
: applyRounding(val, ceil, e, round, roundingFunc, autoExponent);
result[0] = rounded.value;
e = rounded.e;

Expand Down
Loading
Loading