You're seeing just the function new, go back to MyApp.Cldr.Currency module for more information.
Link to this function

new(currency, options \\ [])

View Source


new(Cldr.Currency.code(), map() | Keyword.t()) ::
  {:ok, Cldr.Currency.t()} | {:error, {module(), String.t()}}

Returns a Currency struct created from the arguments.


  • currency is a private use currency code in a format defined by ISO4217 which is X followed by two alphanumeric characters.

  • options is a map of options representing the optional elements of the Cldr.Currency.t struct.


  • :name is the name of the currency. Required.
  • :digits is the precision of the currency. Required.
  • :symbol is the currency symbol. Optional.
  • :narrow_symbol is an alternative narrow symbol. Optional.
  • :round_nearest is the rounding precision such as 0.05. Optional.
  • :alt_code is an alternative currency code for application use.
  • :cash_digits is the precision of the currency when used as cash. Optional.
  • :cash_rounding_nearest is the rounding precision when used as cash such as 0.05. Optional.


  • {:ok, Cldr.Currency.t} or

  • {:error, {exception, message}}


  iex>, name: "Custom Name", digits: 0)
     alt_code: :XAA,
     cash_digits: 0,
     cash_rounding: nil,
     code: :XAA,
     count: %{other: "Custom Name"},
     digits: 0,
     from: nil,
     iso_digits: 0,
     name: "Custom Name",
     narrow_symbol: nil,
     rounding: 0,
     symbol: "XAA",
     tender: false,
     to: nil

 iex>, name: "Custom Name")
 {:error, "Required options are missing. Required options are [:name, :digits]"}

 {:error, {Cldr.CurrencyAlreadyDefined, "Currency :XBC is already defined."}}