Cldr.Unit.base_unit

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

Returns the base unit for a given unit.

Argument

  • unit is either a t:Cldr.Unit, an atom or a t:String

Returns

  • {:ok, base_unit} or

  • {:error, {exception, reason}}

Example

iex> Cldr.Unit.base_unit :square_kilometer
{:ok, :square_meter}

iex> Cldr.Unit.base_unit :square_table
{:error, {Cldr.UnknownUnitError, "Unknown unit was detected at \"table\""}}