Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

1 Commit

Repository files navigation

🌍 globalprice

Smart and dynamic pricing engine for global applications, supporting real-time currency conversion, quantity, discounts, tax calculations, and formatted output.


🚀 Features

  • 🌐 Supports 160+ currencies
  • 🔄 Auto-fetches latest exchange rates
  • 🧾 VAT / GST / custom tax support
  • 💸 Discount by percentage or fixed value
  • 📦 Quantity multiplier
  • 🪙 Currency symbol & locale-aware formatting
  • 🧠 Works offline using cached or fallback rates
  • 🔐 .env support for premium API keys

📦 Installation

npm install globalprice

✨ Usage Example

const{ calculatePrice, updateRates }=require("globalprice");awaitupdateRates();// optional, updates latest ratesconstresult=awaitcalculatePrice({basePrice: 100,quantity: 2,currency: "LKR",discount: {type: "percent",value: 10},tax: {type: "VAT",rate: 12},format: true});console.log(result.formatted);// 'Rs 7320.00'

🧪 Test Locally

npm test

🔐 Environment Setup

Add .env for custom API keys:

EXCHANGE_API_KEY=your_api_key_here

📁 Folder Structure

globalprice/
├── src/
│ ├── index.js
│ ├── rates.js
│ └── currencies.js
├── cache/
│ └── exchangeRates.json
├── test/
│ └── globalprice.test.js
├── .env
├── package.json
├── LICENSE
└── README.md

📄 License

MIT © Menula De Silva

About

Smart pricing engine with live exchange rates, discount, tax and quantity support.

Topics

Resources

Stars

8 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages