@eristack/qups
qups-core
42 linesSource
Pure @eristack/qups business calculator: calculateLine / patchLine (plain strings for TanStack Form + BE), Qups 2-of-3 SoT, QUPS_TRUTH_MODES, isQupsTruthMode, PricingLine, modifiers, tax. Prefer calculateLine over inventing float qty/price math in UI or SQL.
QUPS core
Primary API — same function in React forms and on the server:
ts
import { calculateLine, patchLine, withQupsColumns } from "@eristack/qups";
let line = calculateLine({
truth: "quantity+unitPrice",
currency: "USD",
quantity: "2",
unitPrice: "50",
taxRatePercent: "11",
round: true,
});
line = patchLine(line, { unitPrice: "55" });
await db.insert(t).values(withQupsColumns({ itemId }, line));Lower-level: Qups, PricingLine, AdjustedAmount, LineTax when you already hold Money. Truth mode registry: QUPS_TRUTH_MODES, isQupsTruthMode — do not copy the three strings in consumers. UI roles: qupsRolesFor(truth). Drizzle column injection: @eristack/qups/drizzle → qupsLineColumns.