io.randomseed.bankster.util.fs/default-encoding
is no longer private.- nREPL server is no longer automatically started when loading
infra.clj
. - Excluded
abs
from being aliased inio.randomseed.bankster.money
. - Removed Midje tests, added clojure.test.
- CircleCI configuration updated.
- Deps updated.
- Deps updated (codox).
- Nil punning added to:
currency/ns-code
,currency/code
,currency/weight
,currency/domain
,currency/kind
,currency/sc
,currency/nr
.
- Fixed a bug that caused an amount to be a kind of
Money
instead ofBigDecimal
whenmoney/value
was called on currency and money.
- Type hinting and assertion tests improved in
money/compare
andmoney/compare-amount
.
-
Fixed a bug which caused rounding mode parsing to not make use of evaluated results of the given expression.
-
Improved rounding mode parsing macros.
-
Fixed type hinting in
fs/absoute-path?
. -
Monetary comparators (
money/compare
andmoney/compare-amounts
) now acceptnil
values. -
Added
money/round-to
for interval-based rounding.
- Rewritten
fs/absolute-path?
andfs/relative-path?
-
Improved
money/on-amount
(now it rescales results to the scale of a money, not the nominal scale of a currency). -
Added alias
money/apply
that points tomoney/on-amount
. -
Added
money/set-amount
.
-
Monetary
implementation forCurrency
objects fixed fornil
registry argument. Affected function:currency/unit
. -
Fixed type hinting in
currency/sc
andcurrency/nr
.
-
Monetary
implementation for maps is more restrictive when registry is passed as an argument. Previously maps were causing some functions to create ad hoc currencies, now the:id
key is used to get the existing currency from a registry. This is in line with the protocol's guidelines. Affected functions:currency/unit
,currency/of-id
. -
Monetary
implementation forCurrency
objects is now fulfilling protocol specification, making ID-only look-ups. Affected functions:currency/unit
,currency/of-id
. -
Monetary
implementation for keywords now falls back to currency code look-up even if the given identifier is not namespace-qualified. Affected functions:currency/unit
,currency/present?
. It fixes the chicken or the egg problem during registry building. -
Functions
currency/add-countries
,currency/remove-localized-properties
,currency/add-localized-properties
,currency/add-weighted-code
andcurrency/update
are now more strict and require currency ID to be given (not currency code).
BREAKING CHANGES:
- Low-level function
currency/add-weighted-currency
renamed tocurrency/add-weighted-code
.
-
Added
money/data-readers
andmoney/code-readers
constants. -
Added
data_readers_edn.clj
(with generator inimporter/readers-export
) containing data readers for parsing EDN files. -
Fixed a bug causing registry to not be properly set in
currency/with-registry
andregistry/with
. -
Added
fs/get-resource
utility function.
BREAKING CHANGES:
-
Data readers for tagged literals are split into code and data related handlers:
-
Functions
currency/code-literal
andmoney/code-literal
are now emitting Clojure forms that are to be evaluated to produceCurrency
andMoney
objects. -
Functions
currency/data-literal
andmoney/data-literal
are now returningCurrency
andMoney
objects. -
Tagged literal handlers (for both Clojure code and data) can now be controlled by the environment (e.g. dynamic variables for setting alternate registry or rounding mode during parsing).
-
Constant
bankster/tagged-literals
moved tomoney/tagged-literals
.
-
- Fixed issue with data-readers file visibility by adding a copy to resources directory.
- Added
io.randomseed.bankster/data-readers
map to expose tagged literal handlers.
- Fixed a bug causing
money/of-registry
to not rescale amounts.
-
Function
money/div-rem
renamed tomoney/rem
and improved to behave likemoney/div
in terms of accepted argument types, rounding and rescaling. -
Added function
money/abs
. -
Added aliases:
money/+
,money/-
,money/*
,money//
,money/min
,money/max
. -
Added aliases:
money/>
,money/>=
,money/<
,money/<=
,money/=
,money/==
. -
Added aliases:
money/pos?
,money/neg?
,money/zero?
. -
Conversion functions
scale/->int
,scale/->long
,scale/->double
,scale/->float
,scale/to-plain-string
,scale/to-clojure-string
,scale/to-symbol
,scale/to-clojure-symbol
are now usingscale/amount
to get the actual amount of the given scalable instead of expectingBigDecimal
values.
BREAKING CHANGES:
- Function
money/pos
now returns its argument. Usemoney/abs
to get the absolute value.
- Dependencies updated.
-
Monetary
protocol methods are now more strict about the origin of currency if a registry is given (by-ID resolving and getting from a registry happens even forCurrency
objects). -
Unary variants of
money/div
andmoney/div-scaled
are now able to takeMoney
as arguments (common operation when recalculating exchange rates). -
Protocol method implementations of
money/value
short-circuit onnil
given as an amount. -
Added functions:
money/auto-scaled?
,money/of-registry
andmoney/on-amount
. -
Fixed a bug causing division and multiplication of auto-scaled currencies to rescale results to latest scales of the amounts instead of performing scale-free calculations.
-
Added stripping of trailing zeros before performing scale-free divisions – causes non-terminal decimal expansion to end after more optimal (lesser) number of decimal digits.
- Improved parsing of rounding modes.
- Added
currency/update
for updating currencies with additional data preservation (localized properties, countries, etc.). - Added
money/cast
for casting monetary amounts across currencies (different or slightly different, e.g. sourced in another registries). - Added
scale/to-clojure-string
,scale/to-symbol
,scale/to-clojure-symbol
. - Added
money/->symbol
,money/->clojure-symbol
,money/->double
,money/->float
. - Improved
money/value
to be more polymorphic (currency argument). - Improved conversion functions:
scale/->int
,scale/->long
,scale/->float
,scale/->double
. - Type hinting improved in multiple functions and protocol methods.
BREAKING CHANGES:
- Conversion functions now have different arities:
scale/->int
,scale/->long
,scale/->float
,scale/->double
. - Function
scale/to-plain-string
is now converting decimals to plain strings without addingM
suffix when there is too many digits. This functionality was moved toscale/to-clojure-string
.
- Function
money/convert
now accepts a price and is more polymorphic. - Added the function
currency/localized-properties
.
- Improved and unified rescaling of
Money
objects when their currency is auto-scaled. - Functions
money/amount
,money/stripped-amount
andmoney/currency
are now polymorphic. - Currencies database updated.
- Better printing of monetary amounts of big precision (adding
M
letter to a number). - Better parsing of monetary amounts of big precision (early conversion to big decimals to avoid scientific notation).
- Fixed a bug reversing order of weighted currencies.
- Added missing
Monetary
implementation functions forMoney
. - Improved
currency/id
Monetary
implementation to support currency codes.
- Fixed a bug that caused wrong locale detection on some environments, caused by redundant localized properties preparation (double parsing of locale object initially expressed with a keyword).
- Currency codes are now default fallback identifiers of registered currencies.
- Fixed (re-)setting of localized properties during currency registering.
- Removed accidental databases from the resources.
- Initial release.