Cashmoneyloan
Cashmoneyloan is a tool for performing calculations on loans in JavaScript.
Features
- Calculate monthly payment figures (loanMonthlyPayment)
- Loan total Interest (totalInterest)
- Income Balance after loan Instalment (netIncomeBalance)
- Payment to income ratio (loanPaymentToIncome)
Usage
With npm:
npm install cashmoneyloan
Calculate monthly payment figures
This displays figures meant to be montly payments.
leveraging destructuring
Example: (Node js)
const { loanMonthlyPayment, totalInterest, netIncomeBalance, loanPaymentToIncome } = require('cashmoneyloan'); // ./index.js
loanMonthlyPayment(loanAmount, monthlyLoanPeriod, interestRate)
loanPaymentToIncome(loanInstalments, income);
totalInterest(loanMonthlyPayment, monthlyLoanPeriod, loanAmount);
netIncomeBalance(income, loanInstalments);
console.log(loanMonthlyPayment(1000000,10,10)); //104640
Example: (React js)
import {loanMonthlyPayment, loanPaymentToIncome, netIncomeBalance} from 'cashmoneyloan';
export default function App() {
const income = 5000;
const loanAmount = 100000;
const monthlyLoanPeriod = 60;
const interestRate = 10;
const monthlyLoanInstalment = loanMonthlyPayment(loanAmount,monthlyLoanPeriod,interestRate);
const paymentToIncomeRatio = loanPaymentToIncome(monthlyLoanInstalment, income);
const IncomeBalance = netIncomeBalance(income, monthlyLoanInstalment);
return (
<div className="container">
<h1>LOAN CALCULATOR</h1>
<p>Customer: James Opio</p>
<p>Income: ${income}</p>
<p>Mortgage : ${loanAmount}</p>
<p>Duration: {monthlyLoanPeriod} months</p>
<p>Rate: {interestRate}%</p>
<p>Loan Instalment: ${monthlyLoanInstalment}</p>
<p>Percetage of loan instalment <br/>
to income : ${paymentToIncomeRatio}</p>
<p>Income Balance after loan instalment : ${IncomeBalance}</p>
</div>
);
}