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

0.0.11 • Public • Published

Build Status

StutzJS

  • Solves the accuracy problems of the accountingjs library (http://openexchangerates.github.io/accounting.js) by using a bigdecimal implementation (credits http://mikemcl.github.io/big.js) instead of floatingpoint.
  • supports typescript by providing an ambient typings file

Demo

Getting started

Import the stutz script by adding a script tag in the html header:

<script src="./stutz.standalone.js"></script>

Or by adding an npm dependency

npm install stutzjs --save

Format values

var stutz = money.of("CHF", "1234654987.123");
var formattedMoney = stutz.formatMoney(); // "CHF 1'234'654'987.12"

Parse formatted values

var stutz = money.parse("CHF 1'234'654'987.12");
console.log(stutz.getAmount().toFixed(3)); // "1234654987.120" 
console.log(stutz.getCurrencyCode()); // "CHF" 

see Demo for all configuration options.

Package Sidebar

Install

npm i stutzjs

Weekly Downloads

7

Version

0.0.11

License

ISC

Last publish

Collaborators

  • elekktrisch