33 *
44 * @copyright 2026 Jason Mulligan <jason.mulligan@avoidwork.com>
55 * @license BSD-3-Clause
6- * @version 11.0.34
6+ * @version 11.0.35
77 */
88( 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
99const INVALID_NUMBER = "Invalid number" ;
@@ -398,6 +398,11 @@ function applyNumberFormatting(
398398) {
399399 let result = value ;
400400
401+ // decorateResult passes a negative value that rounds to zero as "-0" so its
402+ // sign survives. It must still get the locale, padding and separator that
403+ // any other zero gets.
404+ const negativeZero = result === "-0" ;
405+
401406 // When padding alongside a locale, let the locale formatter emit the fixed
402407 // number of fraction digits. The manual string padding below cannot tell a
403408 // locale-inserted grouping separator from the decimal separator, so it
@@ -406,11 +411,12 @@ function applyNumberFormatting(
406411 pad && round > 0 ? { minimumFractionDigits : round , maximumFractionDigits : round } : undefined ;
407412
408413 // Strings from toPrecision ignore toLocaleString; preserve zero strings
409- // so their precision (e.g. "0.00") is retained.
414+ // so their precision (e.g. "0.00") is retained. "-0" becomes the number -0,
415+ // which the locale formatter prints with its own minus sign.
410416 if (
411417 ( locale === true || locale . length > 0 ) &&
412418 typeof result === "string" &&
413- Number ( result ) !== 0
419+ ( Number ( result ) !== 0 || negativeZero )
414420 ) {
415421 result = parseFloat ( result ) ;
416422 }
@@ -423,7 +429,9 @@ function applyNumberFormatting(
423429 } else {
424430 // Round before separator replacement to ensure excess decimal places
425431 // are truncated when pad is also set (fixes padding + separator bug).
426- if ( separator . length > 0 && pad && round > 0 ) {
432+ // Skipped for "-0": the arithmetic would turn it into -0, whose string
433+ // form "0" drops the sign.
434+ if ( separator . length > 0 && pad && round > 0 && ! negativeZero ) {
427435 const p = Math . pow ( 10 , round ) ;
428436 result = roundingFunc ( result * p ) / p ;
429437 }
0 commit comments