moneyfunx 0.0.24 → 0.0.27
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/package.json +1 -1
- package/src/lib/loan.js +11 -11
- package/src/lib/payments.js +5 -2
- package/src/lib/sorting.js +7 -7
package/package.json
CHANGED
package/src/lib/loan.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*****************
|
|
4
|
-
*** MoneyFunx ***
|
|
5
|
-
*****************
|
|
6
|
-
|
|
7
|
-
mek it funx up
|
|
8
|
-
|
|
9
|
-
This library contains functions used to in personal financial analysis
|
|
10
|
-
|
|
11
|
-
*/
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* *****************
|
|
4
|
+
* *** MoneyFunx ***
|
|
5
|
+
* *****************
|
|
6
|
+
*
|
|
7
|
+
* mek it funx up
|
|
8
|
+
*
|
|
9
|
+
* This library contains functions used to in personal financial analysis
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Calculates the minimum payment to pay the principal back in the number of periods at the periodic rate
|
package/src/lib/payments.js
CHANGED
package/src/lib/sorting.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* This file contains functions for sorting Arrays of Loans on certain attributes
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Sorts loans descending by interest rate
|
|
@@ -10,7 +10,7 @@ NOTE: When sorting by avalanche, sort by snowball first for optimal interest min
|
|
|
10
10
|
* @param {Loan} loan2 A loan to be comapred
|
|
11
11
|
* @returns {number} the order in which to sort the loans in descending interest rate
|
|
12
12
|
*/
|
|
13
|
-
export function
|
|
13
|
+
export function avalanche(loan1, loan2) {
|
|
14
14
|
return loan2.annualRate - loan1.annualRate;
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -20,7 +20,7 @@ export function snowball(loan1, loan2) {
|
|
|
20
20
|
* @param {Loan} loan2 A loan to be compared
|
|
21
21
|
* @returns {number} the order in which to sort the loans in ascending princpal
|
|
22
22
|
*/
|
|
23
|
-
export function
|
|
23
|
+
export function snowball(loan1, loan2) {
|
|
24
24
|
return loan1.principal - loan2.principal;
|
|
25
25
|
}
|
|
26
26
|
|