moneylite
v1.0.0
Published
Simple lightweight currency formatter
Maintainers
Readme
Moneylite $
Lightweight, dependency-free utility for formatting currency values in JavaScript and Node.js. Perfect for dashboards, payments, UI display, ecommerce, receipts, and global apps without heavy dependencies.
✨ Features
✔ Zero dependencies ✔ Tiny footprint (~2KB) ✔ Works in Node + Browser ✔ Custom symbols ✔ Custom separators ✔ Symbol before/after ✔ TypeScript types included ✔ Simple API
🚀 Install
npm i moneylite
npm install moneylite🔧 Basic Usage (ES Module)
import { formatCurrency } from "moneylite";
console.log(formatCurrency(2500, "LKR"));
// → "LKR 2,500.00"⚙️ Advanced Usage
formatCurrency(value, code, {
decimals,
symbol,
thousandSeparator,
decimalSeparator,
space,
symbolFirst
})🧾 Example (CommonJS)
const { formatCurrency } = require('moneylite');
console.log(formatCurrency(2500456.23, "LKR",{
symbol: "රු ",
space: true,
symbolFirst: true
}));
// රු 2,500,456.23
console.log(formatCurrency(9999.99, "USD"));
// $ 9,999.99
console.log(formatCurrency(1500.5, "EUR", {symbolFirst:false}));
// 1,500.50 €🪂 Built-in Symbols
import { symbols } from "moneylite";
console.log(symbols);
/*
{
USD: "$",
EUR: "€",
GBP: "£",
INR: "₹",
LKR: "LKR",
AUD: "$",
CAD: "$"
}
*/💡 Why another formatter?
| Library | Size | Browser Ready | Dependencies | | --------------------------- | ------ | ------------- | ------------ | | Intl | huge | ✔ | native | | accounting.js | medium | ✔ | yes | | numeral.js | large | ✔ | yes | | currency.js | medium | ✔ | yes | | moneylite | tiny | ✔ | ❌ |
🌎 Works in Browser
<script src="dist/currency-formatter-lite.min.js"></script>
<script>
console.log(CurrencyFormatter.formatCurrency(1200, "USD"));
</script>(optional UMD build — coming soon)
📜 License
MIT © ChamodS
⭐️ If you like this package
Please give a ⭐️ on GitHub — it helps a lot 💙
