Introduction • How To Install • How To Use • How To Clone • How To Run Tests • Credits • Support • License
This is a pure javascript library of financial calculations derived from: https://github.com/ebradyjobory/finance.js
The key difference between the package above and this package are two-fold:
- All calculations are simple javascript functions that can be imported directly instead of through an object.
- The calculations are broken out into individual modules with individual test files
To add these calculations to your node application, you'll need Git and Node.js (which comes with npm) installed on your computer. From your command line:
# Install this repository
$ npm install alfreema/finance
In your node application, require
the plugin and call the chosen function.
const { payment } = require('finance');
const rate = 2;
const numberOfPayments = 36;
const loanPrincipal = -1000000;
const resultPMT = Number(payment(rate, numberOfPayments, loanPrincipal).toFixed(2));
console.log(`expected result=39232.85\nactual result=${resultPMT}`)
// ...
If you would like a copy of the repository to review or run tests against you can clone the repository with:
# Clone the repository
$ git clone git@github.com:alfreema/finance
# Install dependencies
$ npm i
All functions are tested using the Jest testing framework. To run the tests:
# Run the tests
$ npm test
Note If you get any errors, please report them!
This software uses the following open source packages:
MIT
sendthisfile.com · GitHub @alfreema