This is a JavaScript library for common financial calculations such as compound interest and loan amortization.
You can install this package via npm:
npm install financial-calculations
const { compoundInterest, loanAmortization } = require('financial-calculations');
// Example usage for compound interest calculation
const principal = 1000;
const rate = 0.05; // 5%
const time = 5; // years
const futureValue = compoundInterest(principal, rate, time);
console.log('Future value:', futureValue);
// Example usage for loan amortization calculation
const loanPrincipal = 5000;
const annualRate = 0.06; // 6%
const loanTime = 3; // years
const monthlyPayment = loanAmortization(loanPrincipal, annualRate, loanTime);
console.log('Monthly payment:', monthlyPayment);
Calculates the future value of an investment with compound interest.
-
principal
: Initial investment amount. -
rate
: Annual interest rate (as a decimal). -
time
: Time period in years.
Calculates the monthly payment for a loan based on its principal, annual interest rate, and time period.
-
principal
: Loan amount. -
rate
: Annual interest rate (as a decimal). -
time
: Time period in years.
This project is licensed under the MIT License - see the LICENSE file for details.