global-currency-list
v0.0.2
Published
A comprehensive, type-safe, and developer-friendly library for accessing all world currencies, their codes, symbols, and country associations. Perfect for financial apps, expense trackers, and internationalization.
Downloads
14
Maintainers
Readme
🌍 Global Currency List
A comprehensive, type-safe, and developer-friendly library for accessing all world currencies, their codes, symbols, and country associations.
Perfect for financial apps, expense trackers, and internationalization.
Features
- 🔎 Get all currencies with code, name, symbol, and country info
- 🏷️ Lookup by currency code, country name, or currency name
- 🌐 ISO 4217 and ISO 3166-1 compliant
- 🛡️ TypeScript support
- 🧩 Zero dependencies
Installation
npm install global-currency-list
# or
yarn add global-currency-listUsage
import {
getAllCurrencies,
getCurrencyByCode,
getCurrencyByCountryName,
getCurrencyByCurrencyName,
} from "global-currency-list";
// Get all currencies
const all = getAllCurrencies();
console.log(all);
// Get by currency code
const usd = getCurrencyByCode("USD");
console.log(usd);
// Get by country name
const sriLanka = getCurrencyByCountryName("SRI LANKA");
console.log(sriLanka);
// Get by currency name
const rupee = getCurrencyByCurrencyName("Sri Lankan Rupee");
console.log(rupee);API
getAllCurrencies(): Currency[]
Returns an array of all currency objects.
getCurrencyByCode(code: string): Currency | undefined
Returns a currency object for the given ISO 4217 code.
getCurrencyByCountryName(countryName: string): Currency | undefined
Returns a currency object for the given country name (case-insensitive).
getCurrencyByCurrencyName(currencyName: string): Currency | undefined
Returns a currency object for the given currency name (case-insensitive).
Currency Object Structure
interface Currency {
country_name: string;
currency_name: string;
code: string; // ISO 4217 code
currency_number: string;
decimal_units: string;
symbol: string;
}Example Output
{
"country_name": "SRI LANKA",
"currency_name": "Sri Lankan Rupee",
"code": "LKR",
"currency_number": "144",
"decimal_units": "2",
"symbol": "Rs"
}License
MIT
Contributing
Pull requests and issues are welcome!
Please open an issue to discuss your ideas or report bugs.
