Package Exports
- numwriter
- numwriter/dist/numwriter.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (numwriter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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'