moneyfunx 0.0.37 → 0.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/payments.js +1 -1
- package/package.json +1 -1
- package/src/lib/payments.ts +1 -1
package/build/lib/payments.js
CHANGED
|
@@ -43,7 +43,7 @@ export function amortizePayments(loan, principal, payment, numPayments, startPer
|
|
|
43
43
|
let amortizationSchedule = [];
|
|
44
44
|
for (let period = 0; period < numPayments; period++) {
|
|
45
45
|
let interestThisPeriod = loan.accrueInterest(principalRemaining);
|
|
46
|
-
let principalThisPeriod = Math.min((period ===
|
|
46
|
+
let principalThisPeriod = Math.min((period === numPayments - 1 ? payment + carryover : payment) - interestThisPeriod, principalRemaining);
|
|
47
47
|
principalRemaining -= principalThisPeriod;
|
|
48
48
|
amortizationSchedule.push({
|
|
49
49
|
period: startPeriod + period + 1,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "moneyfunx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.38",
|
|
5
5
|
"description": "MoneyFunx is a small library of functions for financial computations, with a focus on personal finance",
|
|
6
6
|
"main": "build/index.js",
|
|
7
7
|
"types": "build/index.d.ts",
|
package/src/lib/payments.ts
CHANGED
|
@@ -72,7 +72,7 @@ export function amortizePayments(
|
|
|
72
72
|
for (let period = 0; period < numPayments; period++) {
|
|
73
73
|
let interestThisPeriod = loan.accrueInterest(principalRemaining);
|
|
74
74
|
let principalThisPeriod = Math.min(
|
|
75
|
-
(period ===
|
|
75
|
+
(period === numPayments - 1 ? payment + carryover : payment) - interestThisPeriod,
|
|
76
76
|
principalRemaining
|
|
77
77
|
);
|
|
78
78
|
principalRemaining -= principalThisPeriod;
|