moneyfunx 0.0.43 → 0.0.44

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.
@@ -22,6 +22,7 @@ export interface ILoan {
22
22
  periods: number;
23
23
  minPayment: number;
24
24
  totalInterest: number;
25
+ name?: string;
25
26
  }
26
27
  export declare class Loan implements ILoan {
27
28
  id: string;
@@ -33,6 +34,7 @@ export declare class Loan implements ILoan {
33
34
  periods: number;
34
35
  minPayment: number;
35
36
  totalInterest: number;
37
+ name?: string;
36
38
  /**
37
39
  * @constructor
38
40
  * @param {number} principal The amount borrowed
@@ -40,7 +42,7 @@ export declare class Loan implements ILoan {
40
42
  * @param {number} periodsPerYear The number of times the interest is accrued in a year
41
43
  * @param {number} termInYears The number of years the loan is repaid over
42
44
  */
43
- constructor(principal: number, annualRate: number, periodsPerYear: number, termInYears: number);
45
+ constructor(principal: number, annualRate: number, periodsPerYear: number, termInYears: number, name?: string);
44
46
  /**
45
47
  * Verifies a payment amount is valid
46
48
  * Throws a PaymentTooLowError if the payment amount is less than the loan's minimum payment
package/build/lib/loan.js CHANGED
@@ -19,7 +19,7 @@ export class Loan {
19
19
  * @param {number} periodsPerYear The number of times the interest is accrued in a year
20
20
  * @param {number} termInYears The number of years the loan is repaid over
21
21
  */
22
- constructor(principal, annualRate, periodsPerYear, termInYears) {
22
+ constructor(principal, annualRate, periodsPerYear, termInYears, name) {
23
23
  this.id = String(Math.floor(Math.random() * Date.now()));
24
24
  this.principal = principal;
25
25
  this.annualRate = annualRate;
@@ -29,6 +29,7 @@ export class Loan {
29
29
  this.periods = this.periodsPerYear * this.termInYears;
30
30
  this.minPayment = this.calculateMinPayment();
31
31
  this.totalInterest = this.minPayment * this.periods - this.principal;
32
+ this.name = name;
32
33
  }
33
34
  /**
34
35
  * 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": "0.0.43",
4
+ "version": "0.0.44",
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
  totalInterest: number;
29
+ name?: string;
29
30
  }
30
31
 
31
32
  export class Loan implements ILoan {
@@ -38,6 +39,7 @@ export class Loan implements ILoan {
38
39
  periods: number;
39
40
  minPayment: number;
40
41
  totalInterest: number;
42
+ name?: string;
41
43
 
42
44
  /**
43
45
  * @constructor
@@ -50,7 +52,8 @@ export class Loan implements ILoan {
50
52
  principal: number,
51
53
  annualRate: number,
52
54
  periodsPerYear: number,
53
- termInYears: number
55
+ termInYears: number,
56
+ name?: string,
54
57
  ) {
55
58
  this.id = String(Math.floor(Math.random() * Date.now()));
56
59
  this.principal = principal;
@@ -61,6 +64,7 @@ export class Loan implements ILoan {
61
64
  this.periods = this.periodsPerYear * this.termInYears;
62
65
  this.minPayment = this.calculateMinPayment();
63
66
  this.totalInterest = this.minPayment * this.periods - this.principal;
67
+ this.name = name;
64
68
  }
65
69
 
66
70
  /**