money-safe
v0.1.0TYPE-SAFE MONEY
DECIMAL STRINGS FOR INPUT · MINOR UNITS FOR STORAGE · JSON FOR AUDIT TRAILS
MONEY VALUES WITH CLEAR BOUNDARIES

money-safe

Accept decimal strings at product boundaries, store integer minor units, and move auditable money payloads between services without guessing.

checkout payload
INSTALL
pnpm add @crapthings/money-safe
import { amount } from '@crapthings/money-safe';
const subtotal = amount('19.99', 'CNY').times(3);
const total = subtotal.minus('5.00').plusMinor(1200);
const payment = total.toJSON();
// { amountMinor: '6697', currency: 'CNY', minorUnit: 2 }
Clear Boundariesmoney-safe stays focused
Handles amount shapedecimal, minor, JSON

Parse, calculate, allocate, format, and serialize values deliberately.

Does not own business policyno FX, ledger, tax engine

Keep exchange rates, accounting rules, and provider flows in your app.

Keeps review points visiblerounding is explicit

Number conversion and ratio math make rounding choices visible in code.