From 9059665ed2982c845a8728241051cb376b143fcd Mon Sep 17 00:00:00 2001 From: greptile-bot Date: Sat, 25 Jul 2026 14:51:54 -0700 Subject: [PATCH] Add tax calculation --- src/tax.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 src/tax.ts diff --git a/src/tax.ts b/src/tax.ts new file mode 100644 index 0000000..bb1b61f --- /dev/null +++ b/src/tax.ts @@ -0,0 +1,10 @@ +import { totalCents, type CartItem, type Discount } from './cart' + +export function totalWithTaxCents( + items: CartItem[], + taxRatePercent: number, + discount?: Discount, +): number { + const base = totalCents(items, discount) + return base + base * (taxRatePercent / 100) +}