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

num-to-letter

v1.0.3

Published

The Number-to-Words Money Conversion Library is a specialized utility designed to convert numeric currency values into fully spelled-out words, supporting accurate, readable, and legally recognized textual representations of financial amounts.

Downloads

150

Readme

NumberToLetter English Version

A TypeScript utility library that converts numbers to their written Spanish representation. Perfect for generating invoices, checks, or any document that requires numbers to be written out in words.

Features

  • ✅ Convert numbers to Spanish text representation
  • ✅ Support for decimal numbers
  • ✅ Currency formatting (Dominican Pesos)
  • ✅ Rate conversion with decimal points
  • ✅ TypeScript support with full type definitions
  • ✅ Comprehensive error handling
  • ✅ Unit tested

Installation

npm install number-to-letter

Usage

import { convertNumberToLetter } from 'number-to-letter';

// Basic number conversion
const result = convertNumberToLetter(123.45);
console.log(result);
// Output:
// {
//   number: 123.45,
//   letter: 'CIENTO VEINTITRES PESOS DOMINICANOS CON 45/100',
//   cents: '45',
//   fullDescription: 'CIENTO VEINTITRES',
//   rate: 'CIENTO VEINTITRES PUNTO CUARENTA Y CINCO'
// }

API Reference

convertNumberToLetter(number: string | number): ConvertInterface

Converts a number to its Spanish text representation.

Parameters:

  • numberToLetter: The number to convert (can be string or number)

Returns:

  • ConvertInterface object with the following properties:
    • number: The original number
    • letter: Full text with currency format
    • cents: The decimal part as string
    • fullDescription: Number in words without currency
    • rate: Number with decimal point pronunciation

Examples

// Whole numbers
convertNumberToLetter(1000);
// { fullDescription: 'MIL', ... }

convertNumberToLetter(0);
// { fullDescription: 'CERO', ... }

// Decimal numbers
convertNumberToLetter(100000.45);
// { 
//   fullDescription: 'CIEN MIL',
//   rate: 'CIEN MIL PUNTO CUARENTA Y CINCO',
//   ... 
// }

Supported Range

  • Numbers from 0 to 999,999,999
  • Up to 2 decimal places
  • Currency format in Dominican Pesos

Development

# Install dependencies
npm install

# Run tests
npm test

# Build project
npm run build

Testing

The project includes comprehensive unit tests covering various number ranges and edge cases.

npm test

License

MIT License

Contributing

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

NumberToLetter Versión Español

Una biblioteca en TypeScript que convierte números a su representación escrita en español. Perfecta para generar facturas, cheques o cualquier documento que requiera que los números estén escritos en palabras.

Características

  • ✅ Convierte números a texto en español
  • ✅ Soporte para números decimales
  • ✅ Formato de moneda (Pesos Dominicanos)
  • ✅ Conversión de tasas con puntos decimales
  • ✅ Soporte para TypeScript con definiciones de tipos completas
  • ✅ Manejo de errores robusto
  • ✅ Pruebas unitarias incluidas

Instalación

npm install number-to-letter
import { convertNumberToLetter } from 'number-to-letter';

// Conversión básica
const result = convertNumberToLetter(123.45);
console.log(result);
// Salida:
// {
//   number: 123.45,
//   letter: 'CIENTO VEINTITRÉS PESOS DOMINICANOS CON 45/100',
//   cents: '45',
//   fullDescription: 'CIENTO VEINTITRÉS',
//   rate: 'CIENTO VEINTITRÉS PUNTO CUARENTA Y CINCO'
// }

Referencia de la API

convertNumberToLetter(number: string | number): ConvertInterface Convierte un número a su representación en texto en español.

Parámetros:

  • numberToLetter: El número a convertir (puede ser cadena o número)

Retorna:

  • Un objeto ConvertInterface con las siguientes propiedades:

  • number: El número original

  • letter: Texto completo con formato de moneda

  • cents: La parte decimal como cadena

  • fullDescription: Número en palabras sin moneda

  • rate: Número con pronunciación del punto decimal

Ejemplos

// Números enteros
convertNumberToLetter(1000);
// { fullDescription: 'MIL', ... }

convertNumberToLetter(0);
// { fullDescription: 'CERO', ... }

// Números decimales
convertNumberToLetter(100000.45);
// { 
//   fullDescription: 'CIEN MIL',
//   rate: 'CIEN MIL PUNTO CUARENTA Y CINCO',
//   ... 
// }

Rango Soportado

  • Números del 0 al 999,999,999
  • Hasta 2 decimales
  • Formato de moneda en Pesos Dominicanos

Desarrollo

# Instalar dependencias
npm install

# Ejecutar pruebas
npm test

# Compilar el proyecto
npm run build

Pruebas

El proyecto incluye pruebas unitarias completas que cubren diversos rangos numéricos y casos límite.

npm test

Licencia

Licencia MIT

Contribuciones

¡Contribuciones bienvenidas! No dudes en enviar un Pull Request.