n2words
n2words copied to clipboard
Spanish money
Hello ,
Is there any way to customize the library to have support in some money cases like :
$1.000.000 should be "un millon de pesos"
but translates into "un millón pesos"
same with
$1.000.001 should be "un millón un peso"
Translates into "un millón uno peso"
thanks!
Today, the library does not support currencies. We may add it in the future. Thanks for the suggestion.
Hello, I applied 2 functions that fixes my problems in case somebody has the same problem as me.
Assuming you put "de pesos" after the numer in words:
//millions definition
const isMillion = (num) => (Number.isInteger(num / 1000000) ? ' de' : '');
// uno vs un
const isUno = (string) => string && string.replace(/uno/g, 'un');