moneyfunx 1.0.16 → 1.0.18
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 +6 -18
- package/src/lib/payments.ts +8 -1
package/build/lib/payments.js
CHANGED
|
@@ -106,7 +106,7 @@ export function payLoans(loans, payment, reduceMinimum = false) {
|
|
|
106
106
|
// handle calculating information for the rest of the loans
|
|
107
107
|
loans.slice(paidLoans).forEach((loan, index) => {
|
|
108
108
|
const loanPrincipalRemaining = loanPrincipalsRemaining[loan.id];
|
|
109
|
-
const paidPeriods = amortizePayments(loan, loanPrincipalRemaining, loan.minPayment, periodsToPay, periodsElapsed, (index === 0 && !reduceMinimum) ? firstLoanCarryover : 0);
|
|
109
|
+
const paidPeriods = amortizePayments(loan, loanPrincipalRemaining, loan.minPayment, Math.min(periodsToPay, helpers.numPaymentsToZero(loanPrincipalRemaining, loan.minPayment, loan.periodicRate)), periodsElapsed, (index === 0 && !reduceMinimum) ? firstLoanCarryover : 0);
|
|
110
110
|
paymentData[loan.id].amortizationSchedule = [
|
|
111
111
|
...paymentData[loan.id].amortizationSchedule,
|
|
112
112
|
...paidPeriods,
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "moneyfunx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.18",
|
|
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",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "tsc",
|
|
10
10
|
"lint": "eslint",
|
|
11
|
-
"test": "
|
|
11
|
+
"test": "vitest"
|
|
12
12
|
},
|
|
13
13
|
"author": "Kyle Pekosh",
|
|
14
14
|
"repository": {
|
|
@@ -17,22 +17,10 @@
|
|
|
17
17
|
},
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"
|
|
21
|
-
"@babel/types": "^7.22.5",
|
|
22
|
-
"@types/babel__core": "^7.20.1",
|
|
23
|
-
"@types/babel__parser": "^7.1.1",
|
|
24
|
-
"@types/jest": "^29.5.2",
|
|
25
|
-
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
26
|
-
"@typescript-eslint/parser": "^6.21.0",
|
|
27
|
-
"eslint": "^8.53.0",
|
|
28
|
-
"eslint-config-standard-with-typescript": "^39.1.1",
|
|
29
|
-
"eslint-plugin-import": "^2.29.0",
|
|
30
|
-
"eslint-plugin-n": "^16.3.1",
|
|
31
|
-
"eslint-plugin-prettier": "^5.0.1",
|
|
32
|
-
"eslint-plugin-promise": "^6.1.1",
|
|
33
|
-
"jest": "^29.6.1",
|
|
20
|
+
"eslint": "^9.18.0",
|
|
34
21
|
"prettier": "^3.0.3",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
22
|
+
"typescript": "^5.2.2",
|
|
23
|
+
"vite-plugin-eslint": "^1.8.1",
|
|
24
|
+
"vitest": "^3.0.4"
|
|
37
25
|
}
|
|
38
26
|
}
|
package/src/lib/payments.ts
CHANGED
|
@@ -170,7 +170,14 @@ export function payLoans(
|
|
|
170
170
|
loan,
|
|
171
171
|
loanPrincipalRemaining,
|
|
172
172
|
loan.minPayment,
|
|
173
|
-
|
|
173
|
+
Math.min(
|
|
174
|
+
periodsToPay,
|
|
175
|
+
helpers.numPaymentsToZero(
|
|
176
|
+
loanPrincipalRemaining,
|
|
177
|
+
loan.minPayment,
|
|
178
|
+
loan.periodicRate
|
|
179
|
+
),
|
|
180
|
+
),
|
|
174
181
|
periodsElapsed,
|
|
175
182
|
(index === 0 && !reduceMinimum) ? firstLoanCarryover : 0
|
|
176
183
|
);
|