changed
CHANGELOG.md
|
@@ -2,6 2,14 @@
|
2
2
|
|
3
3
|
**Note** `ex_money` 5.13.0 and later is supported on Elixir 1.11 and later versions only. It also requires `ex_cldr_numbers 2.31` or later.
|
4
4
|
|
5
|
## Money v5.16.1
|
6
|
|
7
|
This is the changelog for Money v5.16.1 released on April 23rd, 2024. For older changelogs please consult the release tag on [GitHub](https://github.com/kipcole9/money/tags)
|
8
|
|
9
|
### Bug Fixes
|
10
|
|
11
|
* `Money.sum/2` default exchange rates is always `%{}` even if the exchange rate server is not running. Thanks to @haste for the report. Closes #168.
|
12
|
|
5
13
|
## Money v5.16.0
|
6
14
|
|
7
15
|
This is the changelog for Money v5.16.0 released on April 21st, 2024. For older changelogs please consult the release tag on [GitHub](https://github.com/kipcole9/money/tags)
|
changed
hex_metadata.config
|
@@ -1,11 1,11 @@
|
1
1
|
{<<"links">>,
|
2
2
|
[{<<"Changelog">>,
|
3
|
- <<"https://github.com/kipcole9/money/blob/v5.16.0/CHANGELOG.md">>},
|
3
|
<<"https://github.com/kipcole9/money/blob/v5.16.1/CHANGELOG.md">>},
|
4
4
|
{<<"GitHub">>,<<"https://github.com/kipcole9/money">>},
|
5
5
|
{<<"Readme">>,
|
6
|
- <<"https://github.com/kipcole9/money/blob/v5.16.0/README.md">>}]}.
|
6
|
<<"https://github.com/kipcole9/money/blob/v5.16.1/README.md">>}]}.
|
7
7
|
{<<"name">>,<<"ex_money">>}.
|
8
|
- {<<"version">>,<<"5.16.0">>}.
|
8
|
{<<"version">>,<<"5.16.1">>}.
|
9
9
|
{<<"description">>,
|
10
10
|
<<"Money functions for operations on and localization of a money data type with support\nfor ISO 4217 currencies and ISO 24165 digial tokens (crypto currencies).">>}.
|
11
11
|
{<<"elixir">>,<<"~> 1.11">>}.
|
changed
lib/money.ex
|
@@ -1280,10 1280,10 @@ defmodule Money do
|
1280
1280
|
* `money_list` is a list of any valid `t:Money.t/0` types returned
|
1281
1281
|
by `Money.new/2`.
|
1282
1282
|
|
1283
|
- * `rates` is a map of exchange rates. The default is `%{}`.
|
1284
|
- `Money.ExchangeRates.latest_rates/0` can be used to return
|
1285
|
- the latest known exchange rates which can then applied as
|
1286
|
- the `rates` parameter.
|
1283
|
* `rates` is a map of exchange rates. The default is the rates
|
1284
|
returned by `Money.ExchangeRates.latest_rates/0`. If the
|
1285
|
exchange rates retriever is not running, then the default is
|
1286
|
`%{}`.
|
1287
1287
|
|
1288
1288
|
## Returns
|
1289
1289
|
|
|
@@ -1311,13 1311,13 @@ defmodule Money do
|
1311
1311
|
@spec sum([t(), ...], ExchangeRates.t() | {:ok, ExchangeRates.t()} | {:error, {module(), String.t()}}) ::
|
1312
1312
|
{:ok, t} | {:error, {module(), String.t()}}
|
1313
1313
|
|
1314
|
- def sum(money_list, rates \\ Money.ExchangeRates.latest_rates())
|
1314
|
def sum(money_list, rates \\ latest_rates_or_empty_map())
|
1315
1315
|
|
1316
|
- def sum(money_list, {:ok, %{} = rates}) when is_list(money_list) do
|
1316
|
def sum(money_list, {:ok, rates}) when is_map(rates) do
|
1317
1317
|
sum(money_list, rates)
|
1318
1318
|
end
|
1319
1319
|
|
1320
|
- def sum(money_list, {:error, reason}) when is_list(money_list) do
|
1320
|
def sum(_money_list, {:error, reason}) do
|
1321
1321
|
{:error, reason}
|
1322
1322
|
end
|
1323
1323
|
|
|
@@ -1332,6 1332,13 @@ defmodule Money do
|
1332
1332
|
end)
|
1333
1333
|
end
|
1334
1334
|
|
1335
|
defp latest_rates_or_empty_map do
|
1336
|
case Money.ExchangeRates.latest_rates() do
|
1337
|
{:error, _} -> %{}
|
1338
|
{:ok, map} when is_map(map) -> map
|
1339
|
end
|
1340
|
end
|
1341
|
|
1335
1342
|
@doc """
|
1336
1343
|
Compares two `Money` values numerically. If the first number is greater
|
1337
1344
|
than the second :gt is returned, if less than :lt is returned, if both
|
changed
mix.exs
|
@@ -1,7 1,7 @@
|
1
1
|
defmodule Money.Mixfile do
|
2
2
|
use Mix.Project
|
3
3
|
|
4
|
- @version "5.16.0"
|
4
|
@version "5.16.1"
|
5
5
|
|
6
6
|
def project do
|
7
7
|
[
|