← All packages

@lacspace/tax

v1.0.0Commerce & Ledger0 deps

VAT & sales-tax done right — exact integer minor-unit arithmetic (no float cents bugs), add/extract tax, inclusive & exclusive prices, compound taxes, half-up/bankers rounding. Isomorphic.

npm i @lacspace/tax

Usage

tax.ts
import { addTax, extractTax, RATES } from "@lacspace/tax";

addTax(100000, RATES.NP_VAT);      // 113000  — adds 13% VAT (integer paisa)
extractTax(113000, RATES.NP_VAT);  // { net: 100000, tax: 13000 } — from a VAT-inclusive price
// RATES also ships IN_GST, EU_VAT, UK_VAT presets

Exports 5

taxaddTaxextractTaxcompoundRATES

Keywords

taxvatsales-taxgsttax-inclusiverounding

More in Commerce & Ledger