@welldot/utils

FormatNumberOptions

Properties

fallback?

optional fallback?: string

Returned for null, undefined, or NaN inputs. Defaults to '—'.


fractionDigits?

optional fractionDigits?: number

Fixed decimal precision — sets both min and max. Takes precedence over the pair below.


locale?

optional locale?: string

BCP 47 locale string (e.g. 'en-US', 'pt-BR', or bare 'en'/'pt'). Defaults to 'en-US'.


maximumFractionDigits?

optional maximumFractionDigits?: number

Maximum fraction digits (ignored if fractionDigits is set).


minimumFractionDigits?

optional minimumFractionDigits?: number

Minimum fraction digits (ignored if fractionDigits is set).


suffix?

optional suffix?: string

String appended after the number, separated by a space (e.g. 'm', 'ft', 'm³').