A collection of helpers to boost the development speed and code share
Use npm or yarn
yarn add bla
npm install bla
import foobar
foobar.pluralize('word') # returns 'words'
foobar.pluralize('goose') # returns 'geese'
foobar.singularize('phenomena') # returns 'phenomenon'
To parse/format money using the pt-br/BRL currency
Add a R$ BRL currency if necessary
- Adds R$ prefix
const withPrefix = addCurrency('20.0')
// return will be: R$ 20.0
Format a number (float) to a BRL currency according to ABNT
- Convert dots to commas
- Adds R$ prefix
- Adds 0 at end if necessary
const abntFormat = parseCurrencyToABNT('20.0')
// return will be: R$ 20,00
Converts a string on BRL currency format to float
- Convert commas to dots
- Removes R$ prefix
- Removes the 0 at end if exists
const floatCurrency = parseCurrencyToFloat('R$ 20,00')
// return will be: 20.0