Package Exports
- tvm-calculator
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tvm-calculator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
tvm-calculator
Introduction
The tvm-calculator package is a library of time value of money calculations that you would find on a financial calculator. This includes functions to find present value, future value, payment amount, number of payments, and interest rate given a set of input parameters.
Installation
Using npm:
$ npm i tvm-calculatorNote: add --save if you are using npm < 5.0.0
or
- Download or fork the repository from GitHub.
- Extract the file tvm-calculator from the project and include it in your application on the client side.
Example Usage
var tvmCalculator = require('tvm-calculator');
// Calculate future value of investment
const periodicPayment = tvmCalculator.calcPMT(
interestRate, // Number: Interest Rate
numberPayments, // Number: Number of Payments
presentValue, // Number: Present Value
futureValue, // Number: Future Value
isBeginning, // Boolean: Is payment made at the BEGINNING of period? (false if END)
isDiscrete, // Boolean: Is compounding DISCRETE? (false if CONTINUOUS)
compoundingFrequency, // Number: Compounding Frequency (12 for monthly)
paymentFrequency // Number: Payment Frequency
);
console.log('Payment amount (PMT): ', periodicPayment);Available Methods
Example method calls listed below. Further details to come.
calcNper
const numberPayments = tvmCalculator.calcNPer(rate, pmt, pv, fv, isBeginning, isDiscrete, cf, pf);calcInterestRate
const interestRate = tvmCalculator.calcInterestRate(nper, pmt, pv, fv, isBeginning, isDiscrete, cf, pf) ;calcPV
const presentValue = tvmCalculator.calcPV(rate, nper, pmt, fv, isBeginning, isDiscrete, cf, pf);calcPMT
const paymentAmount = tvmCalculator.calcPMT(rate, nper, pv, fv, isBeginning, isDiscrete, cf, pf);calcFV
const futureValue = tvmCalculator.calcFV(rate, nper, pmt, pv, isBeginning, isDiscrete, cf, pf);To Do
- Add unit testing
- Improve documentation