Daisy is a daisy-chainable JavaScript money calculator.
var tax = 1.45;
var total = daisy('45').plus(tax).minus(0.2).equals();
console.log('$' + total);
> '$46.25'
Daisy handles sets too!
var payments = [1, 2, 3];
var totalRevenue = daisy(payments).sum().equals();
console.log('$' + totalRevenue);
> '$6.00'
var averagePayment = daisy(payments).average().equals();
console.log('$' + averageRevenue);
> '$2.00'
var fee = 0.50,
netTotal = daisy(payments).sum().minus(fee).equals();
console.log('$' + netTotal);
> '$5.50'
Daisy rounds values and is flexible enough to take any number-like type
var total = daisy('1.437').plus(1).equals();
console.log('$' + total);
> '$2.44'
To build daisy, just clone the project and run npm install
. To execute the linter and tests, just run grunt
.