You're seeing just the function decompose, go back to Cldr.Unit module for more information.
Link to this function

decompose(unit, unit_list, format_options \\ [])

View Source


decompose(unit :: t(), unit_list :: [unit()], options :: Keyword.t()) :: [t()]

Decomposes a unit into subunits.

Any list compatible units can be provided however a list of units of decreasing scale is recommended. For example [:foot, :inch] or [:kilometer, :meter, :centimeter, :millimeter]


  • unit is any unit returned by

  • unit_list is a list of valid units (one or more from the list returned by Cldr.Unit.known_units/0. All units must be from the same unit category.

  • format_options is a Keyword list of options that is added to the last unit in unit_list. The format_options will be applied when calling Cldr.Unit.to_string/3 on the unit. The default is [].


  • a list of units after decomposition or an error tuple


iex> u =!(10.3, :foot)
iex> Cldr.Unit.decompose u, [:foot, :inch]
[!(:foot, 10),!(:inch,, 5))]

iex> u =!(:centimeter, 1111)
iex> Cldr.Unit.decompose u, [:kilometer, :meter, :centimeter, :millimeter]
[!(:meter, 11),!(:centimeter, 11)]