Cldr.Unit.Conversion.base_unit_and_conversion

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

base_unit_and_conversion(unit_name)

View Source

Returns the base unit and the base unit conversionfor a given unit.

Argument

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

Returns

  • {:ok, base_unit, conversion} or

  • {:error, {exception, reason}}

Example

iex> Cldr.Unit.Conversion.base_unit_and_conversion :square_kilometer
{
  :ok,
  :square_meter,
  [square_kilometer: %Cldr.Unit.Conversion{base_unit: [:square, :meter], factor: 1000000, offset: 0}]
}

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