jennifer registry

@deckyard/money

Exact currency amounts in minor units: ISO 4217 currencies, rounding, allocation and exchange

moneycurrencyiso4217decimalrounding

Depend on it

[decks]
"@deckyard/money" = "^0.1.0"

Versions

VersionStatusKindPinRequiresEnginesCapabilities
0.1.0livegit53b620c3ff27-jennifer >=0.26.0 jennifer-tiny >=0.26.0-

License

LGPL-3.0-only

Source

Released from
0.1.0
Published under
@deckyard mplx
Repository owner
deckyard

Resolutions

Times 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.

Readme

@deckyard/money

test Documentation release

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.

Documentation

Install

jvc add @deckyard/money

This vendors the deck to vendor/<scope>/money/. Without jvc, unpack the src/ subtree of a release archive (<scope>-money-<version>.tar.gz) there.

Usage

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
}

Requirements

Jennifer 0.26.0 or newer, jennifer or jennifer-tiny. No capabilities: the deck is pure computation.

Development

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 archive

Licence

LGPL-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.

This deck as JSON