formatNumber
formatNumber(value, format, options)
formatNumber(value, format, options)
Formats the input value into a specified format with separators and units based on the provided configuration. It allows for customizing the display of numeric values by specifying the format, additional options, and custom formatting rules.
Arguments
value
(string | number
): The input value to be formatted.format
(string
, optional): The format string specifying the desired format. Defaults to "0" if not provided.options
(Record<string, any>
): Additional options for customizing the formatting, such as separators and units.
Returns
(string)
: The formatted number or string based on the specified format.
Example
Usage
Notes
The
formatNumber
function allows you to customize the display of numeric values by applying a specified format with separators and units.It supports specifying the format string, additional options for customization, and custom formatting rules, providing flexibility in formatting numeric values.
The function returns the formatted number or string based on the specified format, enhancing the presentation of numerical data.
Last updated
Was this helpful?