Localize.Number.Format.Meta (Localize v0.6.0)

Copy Markdown View Source

Describes the metadata that drives number formatting and provides functions to update the struct.

The metadata is derived from parsing a number format pattern (e.g., "#,##0.###") and captures all the information needed to format a number: digit counts, grouping, rounding, padding, multiplier, and the positive/negative format templates.

Summary

Functions

Returns a new number formatting metadata struct with default values.

Types

t()

@type t() :: %Localize.Number.Format.Meta{
  currency: nil | map(),
  exponent_digits: non_neg_integer(),
  exponent_sign: boolean(),
  format: [{:negative, [any(), ...]} | {:positive, [any(), ...]}, ...],
  fractional_digits: %{max: non_neg_integer(), min: non_neg_integer()},
  grouping: %{
    fraction: %{first: non_neg_integer(), rest: non_neg_integer()},
    integer: %{first: non_neg_integer(), rest: non_neg_integer()}
  },
  integer_digits: %{max: non_neg_integer(), min: non_neg_integer()},
  multiplier: non_neg_integer(),
  number: non_neg_integer(),
  padding_char: String.t(),
  padding_length: non_neg_integer(),
  round_nearest: non_neg_integer(),
  scientific_rounding: non_neg_integer(),
  significant_digits: %{max: non_neg_integer(), min: non_neg_integer()}
}

Functions

new()

@spec new() :: t()

Returns a new number formatting metadata struct with default values.

Returns

  • A Localize.Number.Format.Meta.t() struct.