Exact currency amounts in minor units: ISO 4217 currencies, rounding, allocation and exchange
moneycurrencyiso4217decimalrounding
[decks]
"@deckyard/money" = "^0.1.0"| Version | Status | Kind | Pin | Requires | Engines | Capabilities |
|---|---|---|---|---|---|---|
| 0.1.0 | live | git | 53b620c3ff27 | - | jennifer >=0.26.0 jennifer-tiny >=0.26.0 | - |
LGPL-3.0-only
0.1.0Times a client asked this registry where to find this deck. Not downloads: the registry only stores metadata, and the code is fetched from its repository directly, so we never see an install and cannot count one. Repeated builds inflate these numbers; installs from an existing lockfile do not appear at all. Counted in UTC.
Exact currency amounts for Jennifer, on the decimal library. An amount is an int of minor units with its ISO 4217 code, so it is exact, compares with == and stores as a plain number. Multiplying, dividing and exchanging round to whole minor units in the mode the caller names; allocate splits an amount without losing or creating a cent; amounts of different currencies never mix.
jvc add @deckyard/moneyThis vendors the deck to vendor/<scope>/money/. Without jvc, unpack the src/ subtree of a release archive (<scope>-money-<version>.tar.gz) there.
import "@deckyard/money/" as money;
def net as money.Money init money.parse("19.99", "EUR");
def gross as money.Money init money.multiply($net, "1.19", "half-up");
io.printf("%s EUR\n", money.format($gross)); # 23.79 EUR
for (def part in money.allocate($gross, ["1", "1", "1"])) {
io.printf("%s ", money.format($part)); # 7.93 7.93 7.93
}Jennifer 0.26.0 or newer, jennifer or jennifer-tiny. No capabilities: the deck is pure computation.
tools/check-all.sh # the full gate, as CI runs it
jennifer test src/money_test.j # the test overlay
tools/gen-currencies.sh # refresh the ISO 4217 table
tools/check-docs.sh # docs against the code
tools/pack.sh dist # build the release archiveLGPL-3.0-only, see LICENSE. Copyright (C) 2026 mplx <[email protected]>.
tools/check-headers.sh checks every source file's SPDX header against deck.toml.