npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

currency-denominations

v0.1.0

Published

A comprehensive package providing information about banknotes and coins for all world currencies

Downloads

17

Readme

currency-denominations

npm version CI/CD Pipeline NPM Publishing codecov

A comprehensive package providing information about banknotes and coins for all world currencies.

Installation

npm install currency-denominations

Features

  • 📊 Comprehensive Data: Includes denomination data for 173+ currencies
  • 🔍 Easy Lookup: Simple API to get banknotes and coins for any currency
  • 📝 TypeScript Support: Full TypeScript definitions included
  • 🔄 Multiple Formats: Supports both ES modules and CommonJS
  • 🚀 Zero Dependencies: Lightweight with no external dependencies
  • Well Tested: Thoroughly tested with comprehensive coverage

Usage

ES Modules (Recommended)

import { 
  getDenominations, 
  getNotes, 
  getCoins, 
  getSupportedCurrencies,
  hasDenominations 
} from 'currency-denominations';

// Get all denominations for a currency
const usdData = getDenominations('USD');
console.log(usdData); // { notes: [1, 2, 5, 10, 20, 50, 100], coins: [0.01, 0.05, 0.1, 0.25] }

// Get only banknotes
const eurNotes = getNotes('EUR');
console.log(eurNotes); // [5, 10, 20, 50, 100, 200, 500]

// Get only coins
const eurCoins = getCoins('EUR');
console.log(eurCoins); // [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2]

// Check if currency is supported
const isSupported = hasDenominations('AFN');
console.log(isSupported); // true

// Get all supported currencies
const currencies = getSupportedCurrencies();
console.log(currencies.length); // 173

CommonJS

const { 
  getDenominations, 
  getNotes, 
  getCoins, 
  getSupportedCurrencies 
} = require('currency-denominations');

// Same usage as above
const afnData = getDenominations('AFN');
console.log(afnData); // { notes: [1, 2, 5, 10, 20, 50, 100, 500, 1000], coins: [1, 2, 5] }

API Reference

Core Functions

getDenominations(currencyCode: string)

Returns the complete denomination data for a currency.

Parameters:

  • currencyCode - Three-letter currency code (case-insensitive)

Returns:

  • CurrencyDenomination | null - Object with notes and coins arrays, or null if not found
const gbpData = getDenominations('GBP');
// Returns: { notes: [5, 10, 20, 50], coins: [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2] }

getNotes(currencyCode: string)

Returns only the banknote denominations for a currency.

Parameters:

  • currencyCode - Three-letter currency code

Returns:

  • number[] - Array of banknote values
const jpyNotes = getNotes('JPY');
// Returns: [1000, 2000, 5000, 10000]

getCoins(currencyCode: string)

Returns only the coin denominations for a currency.

Parameters:

  • currencyCode - Three-letter currency code

Returns:

  • number[] - Array of coin values
const jpyCoins = getCoins('JPY');
// Returns: [1, 5, 10, 50, 100, 500]

getSupportedCurrencies()

Returns all supported currency codes.

Returns:

  • string[] - Sorted array of currency codes
// Get all supported currencies
const currencies = getSupportedCurrencies();
// Returns: ['AED', 'AFN', 'ALL', 'AMD', ...]

hasDenominations(currencyCode: string)

Checks if denomination data is available for a currency.

Parameters:

  • currencyCode - Three-letter currency code

Returns:

  • boolean - True if supported, false otherwise
const hasEur = hasDenominations('EUR');
// Returns: true

const hasXyz = hasDenominations('XYZ');
// Returns: false

getAllDenominations()

Returns the complete dataset of all currency denominations.

Returns:

  • CurrencyDenominations - Complete currency denominations object

Utility Functions

getCurrenciesWithNotes()

Returns currencies that have banknotes.

getCurrenciesWithCoins()

Returns currencies that have coins.

getHighestNote(currencyCode: string)

Returns the highest banknote value for a currency.

getLowestNote(currencyCode: string)

Returns the lowest banknote value for a currency.

getHighestCoin(currencyCode: string)

Returns the highest coin value for a currency.

getLowestCoin(currencyCode: string)

Returns the lowest coin value for a currency.

TypeScript Support

The package includes comprehensive TypeScript definitions:

import { CurrencyDenomination, CurrencyDenominations, CurrencyCode } from 'currency-denominations';

interface CurrencyDenomination {
  notes: number[];
  coins: number[];
}

interface CurrencyDenominations {
  [currencyCode: string]: CurrencyDenomination;
}

type CurrencyCode = string;

Supported Currencies

The package includes denomination data for 173+ currencies, including:

  • Major Currencies: USD, EUR, GBP, JPY, CHF, CAD, AUD, etc.
  • Developing Markets: AFN, AMD, AOA, AWG, AZN, BDT, etc.
  • Special Currencies: XOF, XAF, XPF (regional currencies)
  • Commodity Currencies: XAU (Gold), XAG (Silver), XPD (Palladium)
  • Special Drawing Rights: XDR
  • Test Currencies: XTS, XXX

Currency Examples

// US Dollar
getDenominations('USD');
// { notes: [1, 2, 5, 10, 20, 50, 100], coins: [0.01, 0.05, 0.1, 0.25] }

// Euro
getDenominations('EUR');
// { notes: [5, 10, 20, 50, 100, 200, 500], coins: [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2] }

// Afghanistan Afghani
getDenominations('AFN');
// { notes: [1, 2, 5, 10, 20, 50, 100, 500, 1000], coins: [1, 2, 5] }

// West African CFA Franc
getDenominations('XOF');
// { notes: [500, 1000, 2000, 5000, 10000], coins: [5, 10, 25, 50, 100, 200, 250, 500] }

// Special currencies (commodities)
getDenominations('XAU'); // Gold
// { notes: [], coins: [] }

Data Accuracy

The denomination data is based on official currency information and includes:

  • Current banknotes and coins in circulation
  • Standard denominations for each currency
  • Empty arrays for special currencies without physical denominations
  • Accurate decimal values for fractional denominations

Testing

The package includes a comprehensive test suite with 100% code coverage:

# Run all tests
npm test

# Run tests with coverage report
npm run test:coverage

# Run tests in watch mode (for development)
npm run test:watch

# Run tests for CI (with JUnit output)
npm run test:ci

# Run legacy test script
npm run test:legacy

Test Coverage

  • API Functions: Complete testing of all public API functions with edge cases
  • Data Integrity: Validation of all currency data for consistency and correctness
  • TypeScript Compliance: Ensures proper type definitions and exports
  • Integration Tests: End-to-end workflow testing and error handling
  • Performance Tests: Basic performance validation for large datasets

The test suite validates:

  • 173+ currencies with proper denomination data
  • All major world currencies (USD, EUR, GBP, JPY, etc.)
  • Special currencies (XAU, XAG, XDR, etc.)
  • Regional currency unions (XOF, XAF, XPF, XCD)
  • Data format consistency and sorting
  • Proper error handling for invalid inputs

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests for:

  • Additional currency data
  • Bug fixes
  • Documentation improvements
  • New utility functions

Development Setup

  1. Fork and clone the repository
  2. Install dependencies: npm ci
  3. Run tests: npm test
  4. Build the project: npm run build

Release Process

This project uses automated publishing via GitHub Actions:

For Maintainers

  1. Create a Release:

    • Push a version tag: git tag v1.0.0 && git push origin v1.0.0
    • This triggers the Release workflow which creates a GitHub release
  2. Publish to NPM:

    • Publishing a GitHub release automatically triggers the NPM Publishing workflow
    • The package is published to npm with provenance for security

Automated Workflows

  • CI/CD Pipeline (ci.yml): Runs on every push/PR

    • Tests on Node.js 18.x, 20.x, 22.x
    • Type checking with TypeScript
    • 100% test coverage validation
    • Build verification
    • Security auditing
  • Release Workflow (release.yml): Triggered by version tags

    • Builds and tests the package
    • Generates release notes from commit history
    • Creates GitHub release with build artifacts
    • Includes checksums for security
  • NPM Publishing (publish.yml): Triggered by GitHub releases

    • Full test suite validation
    • TypeScript compilation
    • Publishes to npm with provenance
    • Secure publishing with automation tokens

Security Features

  • Provenance: All npm packages include attestations
  • Clean Builds: Validates working directory before publishing
  • Test Coverage: 100% coverage requirement
  • Type Safety: Full TypeScript validation
  • Security Audits: Automated dependency vulnerability scanning

License

MIT License - see LICENSE file for details.

Changelog

0.0.1

  • Complete world currency coverage with 173+ currencies
  • Support for all major currencies (USD, EUR, GBP, JPY, CHF, CAD, AUD, etc.)
  • Comprehensive denomination data for banknotes and coins
  • Full TypeScript definitions
  • ES modules and CommonJS support
  • Complete API with utility functions
  • NEW: Comprehensive Jest testing framework with 100% code coverage
  • NEW: Data integrity validation and quality assurance tests
  • NEW: CI/CD workflow with GitHub Actions
  • NEW: Enhanced error handling for edge cases