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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@fixit293/number-to-words

v1.0.0

Published

Convert numbers to words with support for Nigerian Naira and Kobo

Readme

Number to Words (Naira Edition)

Convert numbers to their word equivalents with support for Nigerian Naira and Kobo. Perfect for generating cheques, invoices, and financial documents.

Features

✅ Convert integers to words (0 - 999,999,999,999) ✅ Decimal/fractional support for kobo ✅ Clean, readable output ✅ Lightweight with zero dependencies ✅ TypeScript support ✅ Works in Node.js and browsers

Installation

npm install number-to-words-naira

or

yarn add number-to-words-naira

Quick Start

import { numberToWord } from "number-to-words-naira";

const result = numberToWord(1234.56);
console.log(result);
// {
//   naira: "One Thousand, Two Hundred and Thirty-Four",
//   kobo: "Five Six"
// }

Usage Examples

Basic Numbers

numberToWord(0);
// { naira: "Zero", kobo: "" }

numberToWord(42);
// { naira: "Forty-Two", kobo: "" }

numberToWord(1000);
// { naira: "One Thousand", kobo: "" }

With Decimals

numberToWord(50.25);
// { naira: "Fifty", kobo: "Two Five" }

numberToWord(1500000.99);
// { naira: "One Million, Five Hundred Thousand", kobo: "Nine Nine" }

Formatting for Financial Documents

const { naira, kobo } = numberToWord(15750.5);
const formatted = `${naira} Naira${kobo ? `, ${kobo} Kobo` : ""} Only`;
console.log(formatted);
// "Fifteen Thousand, Seven Hundred and Fifty Naira, Five Zero Kobo Only"

For Cheque Writing

function formatCheque(amount) {
  const { naira, kobo } = numberToWord(amount);
  if (kobo) {
    return `₦${amount.toFixed(2)} - ${naira} Naira and ${kobo} Kobo Only`;
  }
  return `₦${amount.toFixed(2)} - ${naira} Naira Only`;
}

console.log(formatCheque(5000));
// "₦5000.00 - Five Thousand Naira Only"

API Reference

numberToWord(value)

Converts a number to its word representation.

Parameters:

  • value (number | string): The number to convert. Can include decimals.

Returns:

  • Object with two properties:
    • naira (string): The whole number part in words
    • kobo (string): The decimal part in words (each digit spoken separately)

Examples:

numberToWord(100); // { naira: "One Hundred", kobo: "" }
numberToWord("250.75"); // { naira: "Two Hundred and Fifty", kobo: "Seven Five" }
numberToWord(NaN); // { naira: "", kobo: "" }

Supported Range

  • Minimum: 0
  • Maximum: 999,999,999,999 (999 Billion)
  • Decimals: Up to 2 decimal places (kobo)

Common Use Cases

1. Invoice Generation

const invoiceAmount = 45000.0;
const { naira } = numberToWord(invoiceAmount);
console.log(`Amount in words: ${naira} Naira Only`);

2. Receipt Printing

function printReceipt(amount) {
  const { naira, kobo } = numberToWord(amount);
  return {
    amount: `₦${amount.toFixed(2)}`,
    amountInWords: kobo ? `${naira} Naira, ${kobo} Kobo` : `${naira} Naira`,
  };
}

3. Banking Applications

const transferAmount = 1000000;
const confirmation = numberToWord(transferAmount);
console.log(`You are transferring ${confirmation.naira} Naira`);

Why Use This Package?

  • Nigeria-Specific: Built specifically for Naira and Kobo
  • Reliable: Handles edge cases and various number formats
  • Simple API: Just one function to learn
  • Battle-Tested: Used in production financial applications
  • No Dependencies: Lightweight and fast

Browser Support

Works in all modern browsers and Node.js environments:

  • Chrome, Firefox, Safari, Edge (latest versions)
  • Node.js 12+

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

MIT © [Your Name]

Support

If you find this package useful, please consider:

  • ⭐ Starring the repository
  • 🐛 Reporting bugs
  • 💡 Suggesting new features
  • 📖 Improving documentation

Related Packages


Made with ❤️ for Nigerian developers