numwriter
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

numwriter

Convert numbers and dates in their writen form.
Numwriter supports Portuguese-BR, Spanish and English.

Installing

npm install numwriter

Definitions

locales = 'pt-BR' | 'en-US' | 'es-ES'

currency = 'BRL' | 'DOL' | 'PESO' | 'EUR'

How to use it

Numbers or Currency

import { write } from 'numwriter'

write(320);
// returns 'three hundred twenty'

write(320, { locale: 'pt-BR' });
// returns 'trezentos e vinte'

write(320.50, { currency: 'DOL' });
// returns 'three hundred twenty dollars and fifty cents'

write(320.50, { currency: 'EUR', locale: 'es-ES' });
// returns 'trecientos y veinte euros y cincuenta cents'

Dates

import { writeDate } from 'numwriter'

writeDate('2024-10-11');
// returns 'october 11th, 2024'

writeDate('2024-10-11', { locale: 'pt-BR' });
// returns '11 de outubro de 2024'
 
writeDate('2024-10-11', { locale: 'es-ES' })
// returns '11 de octubre de 2024'

Package Sidebar

Install

npm i numwriter

Weekly Downloads

124

Version

1.0.3

License

MIT

Unpacked Size

15.1 kB

Total Files

15

Last publish

Collaborators

  • devdiogoz