@leaderty/numero-a-texto
v1.0.0
Published
Converts numeric money amounts to Spanish words for Argentine peso expressions.
Downloads
59
Readme
@leaderty/numero-a-texto
Converts numeric money amounts to Spanish words for Argentine peso expressions.
Setup
npm install @leaderty/numero-a-textoFunctions
numerosALetras(num)
Converts a number into a Spanish textual amount including currency and optional cents.
Behavior:
- Uses
Pesofor singular (1) andPesosfor plural. - Includes cents only when cents are greater than zero.
- Uses
Centavofor singular andCentavosfor plural. - For exact million amounts, adds
Debefore currency (example:Un Millón De Pesos). - Rounds input to 2 decimal places before conversion.
Parameters:
num- Numeric amount to convert.
Returns: string
Examples:
numerosALetras(1)
// "Un Peso"
numerosALetras(1532.75)
// "Mil Quinientos Treinta y Dos Pesos Con Setenta y Cinco Centavos"
numerosALetras(1000000)
// "Un Millón De Pesos"