0.1.2 • Published 5 years ago

money-formating v0.1.2

Weekly downloads
8
License
MIT
Repository
github
Last release
5 years ago

MoneyFormating

npm version License: MIT

Convert and format money value (number, string, formatted and non-formatted).

Installation

npm or yarn:

$ npm i money-formating

Description

A little package to format money values.

Examples:

Imports module:

var formating = require('money-formating');

Cents and Money formatter:

//format money to cents value
var cents = formating.moneyToCents(345623.01);

console.log(cents); // 34562301

//format cents to money value
var money = formating.moneyToCents(cents);

console.log(money); // 345623.01

Cents/Money formatter to currency:

var currency = formating.moneyToCents('345623.01');

console.log(currency); // 345.623,01

var currency2 = formating.moneyToCents('456733402', 'BRL');

console.log(currency2); // R$ 4.567.334,02 <- brazilian real

This is not a currency converter, just a formatter.

Currency Data

This lib uses the currency map from localeplanet API.

License

MIT

Author

Rogério Araújo