moneyfunx 1.0.18 → 1.0.19
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/index.d.ts +21 -7
- package/build/index.js +23 -6
- package/build/lib/errors.d.ts +0 -3
- package/build/lib/errors.js +0 -7
- package/package.json +3 -1
- package/src/index.ts +27 -13
- package/src/lib/errors.ts +0 -8
- package/vite.config.js +18 -0
- package/jest.config.js +0 -11
package/build/index.d.ts
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
1
|
+
import { PaymentTooLowError } from './lib/errors.js';
|
|
2
|
+
import { calculateMinPayment, numPaymentsToZero, principalRemaining, interestPaid } from './lib/helperFunctions.js';
|
|
3
|
+
import { Loan } from './lib/loan.js';
|
|
4
|
+
import { determineExtraPayment, amortizePayments, payLoans } from './lib/payments.js';
|
|
5
|
+
import { snowball, avalanche, sortLoans } from './lib/sorting.js';
|
|
6
|
+
export declare const moneyfunx: {
|
|
7
|
+
amortizePayments: typeof amortizePayments;
|
|
8
|
+
avalanche: typeof avalanche;
|
|
9
|
+
calculateMinPayment: typeof calculateMinPayment;
|
|
10
|
+
determineExtraPayment: typeof determineExtraPayment;
|
|
11
|
+
interestPaid: typeof interestPaid;
|
|
12
|
+
Loan: typeof Loan;
|
|
13
|
+
numPaymentsToZero: typeof numPaymentsToZero;
|
|
14
|
+
payLoans: typeof payLoans;
|
|
15
|
+
PaymentTooLowError: typeof PaymentTooLowError;
|
|
16
|
+
principalRemaining: typeof principalRemaining;
|
|
17
|
+
snowball: typeof snowball;
|
|
18
|
+
sortLoans: typeof sortLoans;
|
|
19
|
+
TOTALS: string;
|
|
20
|
+
};
|
|
21
|
+
export default moneyfunx;
|
package/build/index.js
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
// src/index.js
|
|
2
|
+
import { PaymentTooLowError } from './lib/errors.js';
|
|
3
|
+
import { calculateMinPayment, numPaymentsToZero, principalRemaining, interestPaid, } from './lib/helperFunctions.js';
|
|
4
|
+
import { Loan } from './lib/loan.js';
|
|
5
|
+
import { determineExtraPayment, amortizePayments, payLoans, } from './lib/payments.js';
|
|
6
|
+
import { snowball, avalanche, sortLoans } from './lib/sorting.js';
|
|
7
|
+
import { TOTALS } from './lib/constants.js';
|
|
8
|
+
export const moneyfunx = {
|
|
9
|
+
amortizePayments,
|
|
10
|
+
avalanche,
|
|
11
|
+
calculateMinPayment,
|
|
12
|
+
determineExtraPayment,
|
|
13
|
+
interestPaid,
|
|
14
|
+
Loan,
|
|
15
|
+
numPaymentsToZero,
|
|
16
|
+
payLoans,
|
|
17
|
+
PaymentTooLowError,
|
|
18
|
+
principalRemaining,
|
|
19
|
+
snowball,
|
|
20
|
+
sortLoans,
|
|
21
|
+
TOTALS,
|
|
22
|
+
};
|
|
23
|
+
export default moneyfunx;
|
package/build/lib/errors.d.ts
CHANGED
package/build/lib/errors.js
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
export class NegativeBalanceError extends Error {
|
|
2
|
-
constructor(message) {
|
|
3
|
-
super(message);
|
|
4
|
-
Object.setPrototypeOf(this, NegativeBalanceError.prototype);
|
|
5
|
-
this.name = 'NegativeBalanceError';
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
1
|
export class PaymentTooLowError extends Error {
|
|
9
2
|
constructor(message) {
|
|
10
3
|
super(message);
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "moneyfunx",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.19",
|
|
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
|
+
"coverage": "vitest run --coverage",
|
|
10
11
|
"lint": "eslint",
|
|
11
12
|
"test": "vitest"
|
|
12
13
|
},
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
},
|
|
18
19
|
"license": "MIT",
|
|
19
20
|
"devDependencies": {
|
|
21
|
+
"@vitest/coverage-v8": "^3.0.4",
|
|
20
22
|
"eslint": "^9.18.0",
|
|
21
23
|
"prettier": "^3.0.3",
|
|
22
24
|
"typescript": "^5.2.2",
|
package/src/index.ts
CHANGED
|
@@ -1,20 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// src/index.js
|
|
2
|
+
import { PaymentTooLowError } from './lib/errors.js';
|
|
3
|
+
import {
|
|
3
4
|
calculateMinPayment,
|
|
4
5
|
numPaymentsToZero,
|
|
5
6
|
principalRemaining,
|
|
6
7
|
interestPaid,
|
|
7
|
-
} from './lib/helperFunctions';
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
} from './lib/helperFunctions.js';
|
|
9
|
+
import { Loan } from './lib/loan.js';
|
|
10
|
+
import {
|
|
10
11
|
determineExtraPayment,
|
|
11
12
|
amortizePayments,
|
|
12
13
|
payLoans,
|
|
13
|
-
} from './lib/payments';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
} from './lib/payments.js';
|
|
15
|
+
import { snowball, avalanche, sortLoans } from './lib/sorting.js';
|
|
16
|
+
import { TOTALS } from './lib/constants.js';
|
|
17
|
+
|
|
18
|
+
export const moneyfunx = {
|
|
19
|
+
amortizePayments,
|
|
20
|
+
avalanche,
|
|
21
|
+
calculateMinPayment,
|
|
22
|
+
determineExtraPayment,
|
|
23
|
+
interestPaid,
|
|
24
|
+
Loan,
|
|
25
|
+
numPaymentsToZero,
|
|
26
|
+
payLoans,
|
|
27
|
+
PaymentTooLowError,
|
|
28
|
+
principalRemaining,
|
|
29
|
+
snowball,
|
|
30
|
+
sortLoans,
|
|
31
|
+
TOTALS,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default moneyfunx;
|
package/src/lib/errors.ts
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
export class NegativeBalanceError extends Error {
|
|
2
|
-
constructor(message: string) {
|
|
3
|
-
super(message);
|
|
4
|
-
Object.setPrototypeOf(this, NegativeBalanceError.prototype);
|
|
5
|
-
this.name = 'NegativeBalanceError';
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
|
|
9
1
|
export class PaymentTooLowError extends Error {
|
|
10
2
|
constructor(message: string) {
|
|
11
3
|
super(message);
|
package/vite.config.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { fileURLToPath, URL } from 'node:url';
|
|
2
|
+
|
|
3
|
+
import { defineConfig } from 'vite';
|
|
4
|
+
|
|
5
|
+
// https://vitejs.dev/config/
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
base: '/moneyfunx/',
|
|
8
|
+
plugins: [],
|
|
9
|
+
resolve: {
|
|
10
|
+
alias: {
|
|
11
|
+
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
|
12
|
+
},
|
|
13
|
+
extensions: ['.js', '.ts', '.json'], // Ensure file extensions are resolved
|
|
14
|
+
},
|
|
15
|
+
test: {
|
|
16
|
+
exclue: ['build', 'node_modules'],
|
|
17
|
+
},
|
|
18
|
+
});
|