moneyfunx 1.0.12 → 1.0.13
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/loan.d.ts +3 -1
- package/build/lib/loan.js +2 -1
- package/package.json +1 -1
- package/src/lib/loan.ts +4 -0
package/build/lib/loan.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export interface ILoan {
|
|
|
22
22
|
periods: number;
|
|
23
23
|
minPayment: number;
|
|
24
24
|
currentBalance: number;
|
|
25
|
+
fees: number;
|
|
25
26
|
name?: string;
|
|
26
27
|
}
|
|
27
28
|
export declare class Loan implements ILoan {
|
|
@@ -34,6 +35,7 @@ export declare class Loan implements ILoan {
|
|
|
34
35
|
periods: number;
|
|
35
36
|
minPayment: number;
|
|
36
37
|
currentBalance: number;
|
|
38
|
+
fees: number;
|
|
37
39
|
name?: string;
|
|
38
40
|
/**
|
|
39
41
|
* @constructor
|
|
@@ -44,7 +46,7 @@ export declare class Loan implements ILoan {
|
|
|
44
46
|
* @param {number} name (Optional) The name for the loan
|
|
45
47
|
* @param {number} currentBalance (Optional) The current balance of the loan, if different from the principal
|
|
46
48
|
*/
|
|
47
|
-
constructor(principal: number, annualRate: number, periodsPerYear: number, termInYears: number, name?: string, currentBalance?: number);
|
|
49
|
+
constructor(principal: number, annualRate: number, periodsPerYear: number, termInYears: number, name?: string, currentBalance?: number, fees?: number);
|
|
48
50
|
/**
|
|
49
51
|
* Verifies a payment amount is valid
|
|
50
52
|
* Throws a PaymentTooLowError if the payment amount is less than the loan's minimum payment
|
package/build/lib/loan.js
CHANGED
|
@@ -21,7 +21,7 @@ export class Loan {
|
|
|
21
21
|
* @param {number} name (Optional) The name for the loan
|
|
22
22
|
* @param {number} currentBalance (Optional) The current balance of the loan, if different from the principal
|
|
23
23
|
*/
|
|
24
|
-
constructor(principal, annualRate, periodsPerYear, termInYears, name, currentBalance) {
|
|
24
|
+
constructor(principal, annualRate, periodsPerYear, termInYears, name, currentBalance, fees) {
|
|
25
25
|
this.id = String(Math.floor(Math.random() * Date.now()));
|
|
26
26
|
this.principal = principal;
|
|
27
27
|
this.annualRate = annualRate;
|
|
@@ -32,6 +32,7 @@ export class Loan {
|
|
|
32
32
|
this.minPayment = this.calculateMinPayment();
|
|
33
33
|
this.name = name;
|
|
34
34
|
this.currentBalance = currentBalance || principal;
|
|
35
|
+
this.fees = fees || 0;
|
|
35
36
|
}
|
|
36
37
|
/**
|
|
37
38
|
* Verifies a payment amount is valid
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "moneyfunx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.13",
|
|
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/loan.ts
CHANGED
|
@@ -26,6 +26,7 @@ export interface ILoan {
|
|
|
26
26
|
periods: number;
|
|
27
27
|
minPayment: number;
|
|
28
28
|
currentBalance: number;
|
|
29
|
+
fees: number;
|
|
29
30
|
name?: string;
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -39,6 +40,7 @@ export class Loan implements ILoan {
|
|
|
39
40
|
periods: number;
|
|
40
41
|
minPayment: number;
|
|
41
42
|
currentBalance: number;
|
|
43
|
+
fees: number;
|
|
42
44
|
name?: string;
|
|
43
45
|
|
|
44
46
|
/**
|
|
@@ -57,6 +59,7 @@ export class Loan implements ILoan {
|
|
|
57
59
|
termInYears: number,
|
|
58
60
|
name?: string,
|
|
59
61
|
currentBalance?: number,
|
|
62
|
+
fees?: number,
|
|
60
63
|
) {
|
|
61
64
|
this.id = String(Math.floor(Math.random() * Date.now()));
|
|
62
65
|
this.principal = principal;
|
|
@@ -68,6 +71,7 @@ export class Loan implements ILoan {
|
|
|
68
71
|
this.minPayment = this.calculateMinPayment();
|
|
69
72
|
this.name = name;
|
|
70
73
|
this.currentBalance = currentBalance || principal;
|
|
74
|
+
this.fees = fees || 0;
|
|
71
75
|
}
|
|
72
76
|
|
|
73
77
|
/**
|