Imports name this capability’s declared dependencies, which fune builds next to it in your project; each one links to its page.
import { CURRENCY_DIGITS } from "./money_currency_digits_data.ts"; ← this capability’s own data, compiled from data/currency-digits.json into the same file by fune build
/**
* Decimal places in a currency's minor unit, per ISO 4217.
*
* Dividing by 100 is wrong for yen, won, dinar and a few dozen others, so
* anything moving between minor and major units asks here.
*/
export function currencyDigits(currency: string): number {
const row = CURRENCY_DIGITS.find((c) => c.code === currency);
if (row === undefined) {
throw new RangeError(`no ISO 4217 minor unit for currency "${currency}"`);
}
return row.digits;
}