smartmoney77-calculators
v1.0.0
Published
15+ financial calculator functions — compound interest, FIRE, budget planning, credit payoff, inflation, zakat & more. Used by SmartMoney77.com.
Maintainers
Readme
smartmoney77-calculators
15+ financial calculator functions for Node.js and the browser. Zero dependencies, fully typed.
Used by SmartMoney77.com — free financial calculators in 6 languages.
Install
npm install smartmoney77-calculatorsFunctions
| Function | Description |
|---|---|
| compound() | Compound interest with monthly contributions |
| fire() | FIRE (Financial Independence) target calculator |
| fireYears() | Years to reach a savings target |
| monthlyToTarget() | Monthly savings needed for a goal |
| costOfWaiting() | Cost of delaying investments |
| latteFactor() | Small daily expenses compounded over time |
| workHours() | How many work hours a purchase costs |
| feeImpact() | Long-term impact of investment fees |
| inflation() | Purchasing power erosion over time |
| creditPayoff() | Credit card payoff timeline |
| creditInterest() | Total interest on credit card balance |
| emergencyFund() | Emergency fund target and gap analysis |
| emergencyGap() | Emergency fund gap amount |
| educationRoi() | Return on investment of education |
| zakat() | Islamic Zakat obligation calculator |
Quick Start
import { compound, fire, latteFactor } from 'smartmoney77-calculators';
// Compound interest: $10k initial + $500/mo at 7% for 20 years
const result = compound(10000, 500, 7, 20);
console.log(result.futureValue); // ~268,549
console.log(result.totalInterest); // ~138,549
// FIRE calculator: $40k/yr expenses, $100k saved, $2k/mo, 7% return
const fireResult = fire(40000, 100000, 2000, 7);
console.log(fireResult.targetAmount); // 1,000,000
console.log(fireResult.yearsToFire); // ~15.8
// Latte Factor: $5/day coffee invested at 7% for 30 years
const latte = latteFactor(5, 7, 30);
console.log(latte.investedValue); // ~182,000+API
Every function accepts plain numbers and returns a typed result object. All monetary values are rounded to 2 decimal places.
Rates are always expressed as percentages (e.g., 7 for 7%, not 0.07).
compound(principal, monthlyContribution, annualRate, years)
Returns { futureValue, totalContributions, totalInterest }
fire(annualExpenses, currentSavings, monthlyContribution, annualReturn)
Returns { targetAmount, yearsToFire, monthlyRequired }
fireYears(currentSavings, monthlyContribution, annualReturn, target)
Returns number (years as decimal)
monthlyToTarget(currentSavings, annualReturn, years, target)
Returns number (required monthly contribution)
costOfWaiting(monthlyContribution, annualReturn, years, delayYears)
Returns { ifStartNow, ifWait, costOfWaiting }
latteFactor(dailyAmount, annualReturn, years)
Returns { dailyCost, monthlyCost, yearlyCost, investedValue }
workHours(annualSalary, hoursPerWeek, itemCost, taxRate?)
Returns { hoursPerItem, itemsPerHour, effectiveHourlyRate }
feeImpact(principal, monthlyContribution, annualReturn, annualFee, years)
Returns { withoutFees, withFees, feeCost, feePercentageOfGains }
inflation(currentAmount, inflationRate, years)
Returns { futureNominalValue, futurePurchasingPower, purchasingPowerLoss }
creditPayoff(balance, annualRate, monthlyPayment)
Returns { monthsToPayoff, totalPaid, totalInterest }
creditInterest(balance, annualRate, months)
Returns number (total interest)
emergencyFund(monthlyExpenses, targetMonths?, currentSavings?, monthlySavings?)
Returns { targetAmount, currentAmount, gap, monthsToFill }
emergencyGap(monthlyExpenses, targetMonths, currentSavings)
Returns number (gap amount)
educationRoi(tuitionCost, yearsOfStudy, currentSalary, expectedSalary, opportunityCost?)
Returns { totalCost, salaryIncrease, paybackYears, tenYearRoi, roiPercentage }
zakat(cashAndBank, goldValue?, silverValue?, investments?, otherAssets?, liabilities?, goldPricePerGram?)
Returns { totalWealth, nisabThreshold, isZakatDue, zakatAmount }
License
MIT — SmartMoney77.com
