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

1.2.2 • Public • Published

Javascript package for formating and calculating mm kyats. You don't need to convert back float to calculate money. How awsome it can be to calculate '5,400' + '-200' + 900 and comma separate total in one function. Bye Bye NaN & undefine problems :)

// CommonJs
const money = require("mm-money");

// ES6
import money from "mm-money";

money.format(1000); // '1,000.00'
money.formatMM(1000); // '၁,၀၀၀.၀၀'
money.format("1,000"); // '1,000.00'
money.format(2000, { precision: 3 }); // '2,000.000'

money.sum([1000, "1,000.00", "1000", "၁,၀၀၀"]); // '4,000.00'
money.div(20, 10); // '2.00'
money.sub(1000, "500"); // '500.00'
money.parseNumber("1,000.00"); // 1000.0
money.parseNumber("၁,၀၀၀.၀၀"); // 1000.0
money.mul([10, 10]); // '100.00'
// 5 % commission
money.percent("150,000", 5); // '7,500.00'

// default options for all functions
{
    precision: 2
    format: 'eng' // eng | mm
}

Readme

Keywords

none

Package Sidebar

Install

npm i mm-money

Weekly Downloads

2

Version

1.2.2

License

ISC

Unpacked Size

7.3 kB

Total Files

7

Last publish

Collaborators

  • jst_htet