API reference / @localizer/format / autoFormat
Function: autoFormat()
autoFormat(
value
):Localizable
Defined in: fn/autoFormat.ts:124
Formats a value into a Localizable
object based on its type. By default, it uses the following formatters:
- Numbers and bigints: formatted with
decimal
. Number
objects: formatted using their primitive value.Date
objects: formatted withdate
.- Arrays: recursively formatted into a localized list.
Localizable
values: returned as-is.undefined
: represented asEmpty
.- Others: converted to a localized string with
stringify
.
Parameters
Parameter | Type | Description |
---|---|---|
value | unknown | The value to format. |
Returns
A Localizable
object.