Cldr.Unit.BaseUnit.canonical_base_unit

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

canonical_base_unit(unit)

View Source

Returns the canonical base unit name for a unit.

The base unit is the common unit through which conversions are passed.

Arguments

  • unit_string is any string representing a unit such as light_year_per_week.

Returns

  • {:ok, canonical_base_unit} or

  • {:error, {exception, reason}}

Examples

iex> Cldr.Unit.Parser.canonical_base_unit "meter"
{:ok, :meter}

iex> Cldr.Unit.Parser.canonical_base_unit "meter meter"
{:ok, :square_meter}

iex> Cldr.Unit.Parser.canonical_base_unit "meter per kilogram"
{:ok, "meter_per_kilogram"}

iex> Cldr.Unit.Parser.canonical_base_unit "yottagram per mile scandinavian"
{:ok, "kilogram_per_meter"}