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

indonesian-number-words

v1.0.1

Published

A reliable library to convert numerical values into their word equivalents in Bahasa Indonesia with high precision and no floating-point errors.

Readme

Indonesian Number Words

npm License GitHub Workflow Status GitHub Issues

Convert numerical values into their word equivalents in Bahasa Indonesia with high precision and no floating-point errors.

🚀 Features

  • High Precision: Utilizes decimal.js to avoid floating-point inaccuracies.
  • Comprehensive Range: Supports numbers from zero up to triliuns.
  • Negative Number Support: Accurately converts negative numbers with the "minus" prefix.
  • Decimal Handling: Converts fractional parts with precise word representations.
  • TypeScript Support: Fully typed with TypeScript declarations for enhanced developer experience.
  • No Floating Errors: Ensures accurate conversions without common floating-point pitfalls.
  • Lightweight: Optimized for performance and minimal footprint.
  • Easy Integration: Simple API for seamless integration into your projects.

📦 Installation

Ensure you have Node.js installed (version 14 or higher).

npm install indonesian-number-words decimal.js

or using Yarn:

yarn add indonesian-number-words decimal.js

🛠 Usage

JavaScript

const { Terbilang } = require('indonesian-number-words');
const Decimal = require('decimal.js');

console.log(Terbilang.Convert(0)); // "nol"
console.log(Terbilang.Convert(15)); // "sebelas"
console.log(Terbilang.Convert(123)); // "seratus dua puluh tiga"
console.log(Terbilang.Convert(1000)); // "seribu"
console.log(Terbilang.Convert(2500000)); // "dua juta lima ratus ribu"
console.log(Terbilang.Convert(new Decimal(-75))); // "minus tujuh puluh lima"
console.log(Terbilang.Convert(123.45)); // "seratus dua puluh tiga koma empat lima"

TypeScript

import { Terbilang } from 'indonesian-number-words';
import Decimal from 'decimal.js';

console.log(Terbilang.Convert(0)); // "nol"
console.log(Terbilang.Convert(15)); // "sebelas"
console.log(Terbilang.Convert(123)); // "seratus dua puluh tiga"
console.log(Terbilang.Convert(1000)); // "seribu"
console.log(Terbilang.Convert(2500000)); // "dua juta lima ratus ribu"
console.log(Terbilang.Convert(new Decimal(-75))); // "minus tujuh puluh lima"
console.log(Terbilang.Convert(123.45)); // "seratus dua puluh tiga koma empat lima"

Using in a Project

import { Terbilang } from 'indonesian-number-words';
import Decimal from 'decimal.js';

const number = new Decimal(-12345.67);
const words = Terbilang.Convert(number);
console.log(words); // "minus dua belas ribu tiga ratus empat puluh lima koma enam tujuh"

📖 API

Terbilang.Convert(convertNumber: number | Decimal, firstTry?: boolean): string

Parameters

  • convertNumber (number | Decimal): The number to convert. Can be a native JavaScript number or a Decimal instance for higher precision.
  • firstTry (boolean, optional): Internal parameter for recursive calls. Do not modify. Defaults to true.

Returns

  • (string): The word representation of the number in Bahasa Indonesia.

Throws

  • TypeError: If the input is not a number or Decimal instance.
  • RangeError: If the number exceeds the supported range (up to triliuns).

Examples

Terbilang.Convert(100); // "seratus"
Terbilang.Convert(new Decimal(100.5)); // "seratus koma lima"
Terbilang.Convert(-50); // "minus lima puluh"

🧪 Testing

The package uses Jest for testing to ensure reliability and correctness.

Running Tests

npm test

All tests should pass, confirming that the package handles various scenarios correctly, including negative numbers, decimals, and large numbers.

🔧 Development

Building the Package

npm run build

Compiles the TypeScript code into JavaScript, outputting to the dist directory.

📝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the Repository

  2. Create a Feature Branch

    git checkout -b feature/YourFeature
  3. Commit Your Changes

    git commit -m "Add some feature"
  4. Push to the Branch

    git push origin feature/YourFeature
  5. Open a Pull Request

    Provide a clear description of your changes and the problem they solve.

🐞 Issues

If you encounter any issues or have feature requests, please open an issue on GitHub.

📄 License

This project is licensed under the MIT License.

💡 Unique Selling Points

  • No Floating-Point Errors: By leveraging decimal.js, the library ensures precise conversions without the common floating-point inaccuracies found in native JavaScript number types.
  • High Precision: Handles large numbers and decimals with exceptional accuracy, making it ideal for financial and critical applications.
  • Comprehensive Language Support: Specifically tailored for Bahasa Indonesia, ensuring culturally and linguistically accurate representations.
  • TypeScript Ready: Fully typed with TypeScript declarations, providing excellent developer experience and integration with TypeScript projects.
  • Robust Testing: Extensive test coverage ensures reliability across various scenarios, including edge cases and large numbers.
  • Ease of Use: Simple and intuitive API design makes it easy to integrate and use in any JavaScript or TypeScript project.