moneyfunx 3.0.7 → 3.0.8

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 CHANGED
@@ -1,18 +1,64 @@
1
1
  /**
2
- * MoneyFunx
3
- * * mek it funx up
2
+ * Moneyfunx
3
+ * A library for financial calculations regarding debt and investments.
4
4
  */
5
- export { MAX_DURATION_YEARS, TOTALS, } from './lib/constants.js';
6
- export { ILoan, Loan } from './lib/debt/loan.js';
7
- export { determineExtraPayment, amortizePayments, payLoans, } from './lib/debt/payments.js';
8
- export { PaymentRecord, LoansPaymentSchedule, LoanPrincipals, PaymentSchedule, } from './lib/debt/paymentTypes.js';
9
- export { NegativeContributionError, PaymentTooLowError, NegativeWithdrawalError } from './lib/errors.js';
10
- export { amortizeContributions, contributeInstruments, determineExtraContribution, } from './lib/investment/contributions.js';
11
- export { ContributionRecord, ContributionSchedule, InstrumentsContributionSchedule, } from './lib/investment/contributionTypes.js';
12
- export { IInstrument, Instrument } from './lib/investment/instrument.js';
13
- export { calculateAmortizedWithdrawal, drawdownInstruments, } from './lib/investment/withdrawals.js';
14
- export { WithdrawalRecord, WithdrawalSchedule, InstrumentsWithdrawalSchedule, } from './lib/investment/withdrawalTypes.js';
15
- export { performWaterfallDrawdown, } from './lib/investment/strategies.js';
16
- export { calculatePeriodicAmount, calculateBalanceRemaining, calculatePeriodsToZero, calculateInterestOverPeriods, } from './lib/shared/primitives.js';
17
- export { HasRateAndBalance, snowball, avalanche, sortWith } from './lib/shared/sorting.js';
5
+ import * as constants from './lib/constants.js';
6
+ import * as loan from './lib/debt/loan.js';
7
+ import * as payments from './lib/debt/payments.js';
8
+ import * as paymentTypes from './lib/debt/paymentTypes.js';
9
+ import * as errors from './lib/errors.js';
10
+ import * as contributions from './lib/investment/contributions.js';
11
+ import * as contributionTypes from './lib/investment/contributionTypes.js';
12
+ import * as instrument from './lib/investment/instrument.js';
13
+ import * as withdrawals from './lib/investment/withdrawals.js';
14
+ import * as withdrawalTypes from './lib/investment/withdrawalTypes.js';
15
+ import * as strategies from './lib/investment/strategies.js';
16
+ import * as primitives from './lib/shared/primitives.js';
17
+ import * as sorting from './lib/shared/sorting.js';
18
+ export { constants, loan, payments, paymentTypes, errors, contributions, contributionTypes, instrument, withdrawals, withdrawalTypes, strategies, primitives, sorting, };
19
+ /**
20
+ * Consolidated namespace for unambiguous access.
21
+ * @example
22
+ * import moneyfunx from 'moneyfunx';
23
+ * moneyfunx.loan.calculateMonthlyPayment(...);
24
+ */
25
+ declare const moneyfunx: {
26
+ avalanche<T extends sorting.HasRateAndBalance>(obj1: T, obj2: T): number;
27
+ snowball<T_1 extends sorting.HasRateAndBalance>(obj1: T_1, obj2: T_1): number;
28
+ sortWith<T_2 extends sorting.HasRateAndBalance>(sortable: T_2[], sortFunction: (obj1: sorting.HasRateAndBalance, obj2: sorting.HasRateAndBalance) => number): T_2[];
29
+ /**
30
+ * Moneyfunx
31
+ * A library for financial calculations regarding debt and investments.
32
+ */
33
+ calculatePeriodicAmount(startingBalance: number, periodicInterestRate: number, totalNumberOfPeriods: number): number;
34
+ calculateBalanceRemaining(initialBalance: number, periodicAmountApplied: number, periodicInterestRate: number, periodsElapsed: number): number;
35
+ calculatePeriodsToZero(currentBalance: number, periodicAmountApplied: number, periodicInterestRate: number): number;
36
+ calculateInterestOverPeriods(initialBalance: number, periodicAmountApplied: number, periodicInterestRate: number, periodsElapsed: number): number;
37
+ performWaterfallDrawdown(financialInstruments: instrument.Instrument[], targetNetPeriodicIncome: number, totalPeriodsToSimulate: number, effectiveTaxRate?: number): withdrawalTypes.InstrumentsWithdrawalSchedule;
38
+ calculateAmortizedWithdrawal(instrument: instrument.Instrument, currentInstrumentBalance: number, periodicWithdrawalAmount: number, periodsElapsedOffset?: number, applicableTaxRate?: number, accrueBeforeWithdrawal?: boolean): withdrawalTypes.WithdrawalRecord;
39
+ drawdownInstruments(instruments: instrument.Instrument[], targetNetPeriodicIncome: number, totalPeriodsToSimulate: number, effectiveTaxRate?: number, accrueBeforeWithdrawal?: boolean): withdrawalTypes.InstrumentsWithdrawalSchedule;
40
+ Instrument: typeof instrument.Instrument;
41
+ determineExtraContribution(instruments: instrument.Instrument[], contribution: number): number;
42
+ amortizeContribution(instrument: instrument.Instrument, currentBalance: number, contribution: number, startPeriod?: number, accrueBeforeContribution?: boolean): contributionTypes.ContributionRecord;
43
+ amortizeContributions(instrument: instrument.Instrument, initialBalance: number, contribution: number, numContributions: number, startPeriod?: number, accrueBeforeContribution?: boolean): contributionTypes.ContributionRecord[];
44
+ contributeInstruments(instruments: instrument.Instrument[], contribution: number, numContributions: number, accrueBeforeContribution?: boolean): contributionTypes.InstrumentsContributionSchedule;
45
+ /**
46
+ * Moneyfunx
47
+ * A library for financial calculations regarding debt and investments.
48
+ */
49
+ PaymentTooLowError: typeof errors.PaymentTooLowError;
50
+ NegativeContributionError: typeof errors.NegativeContributionError;
51
+ NegativeWithdrawalError: typeof errors.NegativeWithdrawalError;
52
+ determineExtraPayment(loans: loan.ILoan[], payment: number): number;
53
+ determineCarryover(loan: loan.Loan, loanPayment: number, loanFinalPayment: number, reduceMinimum: boolean): number;
54
+ amortizePayments(loan: loan.Loan, principal: number, payment: number | null, numPayments: number | null, startPeriod?: number, carryover?: number): paymentTypes.PaymentRecord[];
55
+ payLoans(loans: loan.Loan[], payment: number, reduceMinimum?: boolean): paymentTypes.LoansPaymentSchedule;
56
+ Loan: typeof loan.Loan;
57
+ TOTALS: "totals";
58
+ MAX_DURATION_YEARS: 110;
59
+ MAX_YIELD_FACTOR: 1.4;
60
+ MIN_GROWTH_FACTOR: 1;
61
+ MIN_YIELD_FACTOR: 0.45;
62
+ };
63
+ export default moneyfunx;
18
64
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,kBAAkB,EAClB,MAAM,GACP,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AAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,aAAa,MAAM,mCAAmC,CAAC;AACnE,OAAO,KAAK,iBAAiB,MAAM,uCAAuC,CAAC;AAC3E,OAAO,KAAK,UAAU,MAAM,gCAAgC,CAAC;AAC7D,OAAO,KAAK,WAAW,MAAM,iCAAiC,CAAC;AAC/D,OAAO,KAAK,eAAe,MAAM,qCAAqC,CAAC;AACvE,OAAO,KAAK,UAAU,MAAM,gCAAgC,CAAC;AAC7D,OAAO,KAAK,UAAU,MAAM,4BAA4B,CAAC;AACzD,OAAO,KAAK,OAAO,MAAM,yBAAyB,CAAC;AAGnD,OAAO,EACL,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,OAAO,GACR,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,SAAS;;;;IA1Cf;;;OAGG;;;;;;;;;;;;;IAHH;;;OAGG;;;;;;;;;;;;;;CAqDF,CAAC;AAEF,eAAe,SAAS,CAAC"}
package/build/index.js CHANGED
@@ -1,14 +1,27 @@
1
1
  /**
2
- * MoneyFunx
3
- * * mek it funx up
2
+ * Moneyfunx
3
+ * A library for financial calculations regarding debt and investments.
4
4
  */
5
- export { MAX_DURATION_YEARS, TOTALS, } from './lib/constants.js';
6
- export { Loan } from './lib/debt/loan.js';
7
- export { determineExtraPayment, amortizePayments, payLoans, } from './lib/debt/payments.js';
8
- export { NegativeContributionError, PaymentTooLowError, NegativeWithdrawalError } from './lib/errors.js';
9
- export { amortizeContributions, contributeInstruments, determineExtraContribution, } from './lib/investment/contributions.js';
10
- export { Instrument } from './lib/investment/instrument.js';
11
- export { calculateAmortizedWithdrawal, drawdownInstruments, } from './lib/investment/withdrawals.js';
12
- export { performWaterfallDrawdown, } from './lib/investment/strategies.js';
13
- export { calculatePeriodicAmount, calculateBalanceRemaining, calculatePeriodsToZero, calculateInterestOverPeriods, } from './lib/shared/primitives.js';
14
- export { snowball, avalanche, sortWith } from './lib/shared/sorting.js';
5
+ import * as constants from './lib/constants.js';
6
+ import * as loan from './lib/debt/loan.js';
7
+ import * as payments from './lib/debt/payments.js';
8
+ import * as paymentTypes from './lib/debt/paymentTypes.js';
9
+ import * as errors from './lib/errors.js';
10
+ import * as contributions from './lib/investment/contributions.js';
11
+ import * as contributionTypes from './lib/investment/contributionTypes.js';
12
+ import * as instrument from './lib/investment/instrument.js';
13
+ import * as withdrawals from './lib/investment/withdrawals.js';
14
+ import * as withdrawalTypes from './lib/investment/withdrawalTypes.js';
15
+ import * as strategies from './lib/investment/strategies.js';
16
+ import * as primitives from './lib/shared/primitives.js';
17
+ import * as sorting from './lib/shared/sorting.js';
18
+ // Named exports for granular access
19
+ export { constants, loan, payments, paymentTypes, errors, contributions, contributionTypes, instrument, withdrawals, withdrawalTypes, strategies, primitives, sorting, };
20
+ /**
21
+ * Consolidated namespace for unambiguous access.
22
+ * @example
23
+ * import moneyfunx from 'moneyfunx';
24
+ * moneyfunx.loan.calculateMonthlyPayment(...);
25
+ */
26
+ const moneyfunx = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, constants), loan), payments), paymentTypes), errors), contributions), contributionTypes), instrument), withdrawals), withdrawalTypes), strategies), primitives), sorting);
27
+ export default moneyfunx;
package/package.json CHANGED
@@ -1,15 +1,13 @@
1
1
  {
2
2
  "name": "moneyfunx",
3
- "version": "3.0.7",
3
+ "version": "3.0.8",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./build/index.d.ts",
8
- "import": "./build/index.js",
9
- "require": "./build/index.cjs"
8
+ "import": "./build/index.js"
10
9
  }
11
10
  },
12
- "main": "./build/index.cjs",
13
11
  "module": "./build/index.js",
14
12
  "types": "./build/index.d.ts",
15
13
  "files": [